66 <legend @click =" showOrHideAllTypes()" >Types</legend >
77 <ul >
88 <li v-for =" type in types" :key =" type.id" >
9- <label >
9+ <label :style = " styleObj(type.name) " class = " type " >
1010 <input
1111 type =" checkbox"
1212 :value =" type.id"
2121 <fieldset >
2222 <legend @click =" showOrHideAllCalendars()" >Calendars</legend >
2323 <ul >
24- <li v-for =" calendar in calendars" :key =" calendar.id" >
25- <label >
24+ <li
25+ v-for =" calendar in calendars"
26+ :key =" calendar.id"
27+ :style =" styleObj(getType(calendar.typeId).name)"
28+ >
29+ <label class =" calendar" >
2630 <input
2731 type =" checkbox"
2832 :value =" calendar.id"
@@ -49,6 +53,7 @@ import toolbar from "../components/toolbar.vue";
4953import feed from " ../components/feed.vue" ;
5054import badge from " ../components/ui/badge" ;
5155import Badge from " ./ui/badge.vue" ;
56+ import events from " ../components/events/fabric.js" ;
5257
5358export default {
5459 components: {
@@ -100,6 +105,20 @@ export default {
100105 isDisplayed: this .selectedCalendarIds .includes (ev .calendarId ),
101106 };
102107 },
108+ color (typeName ) {
109+ return events .typeColorHSL (typeName .toLowerCase (), 0 );
110+ },
111+ styleObj (typeName ) {
112+ const color = this .color (typeName);
113+ return {
114+ " --color-h" : color .h ,
115+ " --color-s" : color .s + " %" ,
116+ " --color-l" : color .l + " %" ,
117+ };
118+ },
119+ getType (id ) {
120+ return this .types .find ((x ) => x .id == id);
121+ },
103122 },
104123 created () {
105124 this .$store .commit (" initialize" );
@@ -162,4 +181,14 @@ export default {
162181 overflow : auto ;
163182 height : 100% ;
164183}
184+ #main label .type ,#main label .calendar {
185+ --hsl : var (--color-h ), var (--color-s ), var (--color-l );
186+ }
187+ #main label .type span , #main label .calendar span {
188+ text-shadow : hsla (var (--hsl ), 0.4 ) 0px 0px 1px ,
189+ hsla (var (--hsl ), 0.4 ) 0px 0px 1px ;
190+ }
191+ #main label .type sup , #main label .calendar sup {
192+ color : hsl (var (--hsl ));
193+ }
165194 </style >
0 commit comments