You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- parse `categories` into a string array on each event object
- add `category-{slug}` CSS classes + `data-categories` attribute on event DOM
- colour-coded left border + background tint for common category names
- document in Event-Object.md and Styling.md; add 3 unit tests
closes#86
Copy file name to clipboardExpand all lines: docs/Styling.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,3 +104,34 @@ Each event could have these values as dataset.
104
104
- data-duration
105
105
- data-title
106
106
- data-location
107
+
- data-categories (comma-separated list of categories, e.g. `"Work,Important"`)
108
+
109
+
## category-based styling
110
+
111
+
Events with a `CATEGORIES` property in the iCal source automatically receive:
112
+
113
+
- A CSS class `category-{slug}` on the event wrapper (e.g. `category-work`, `category-family`). The slug is the category name lowercased, with non-alphanumeric runs replaced by `-` — so `"Doctor's Appointment"` becomes `category-doctor-s-appointment` and `"Freizeit & Sport"` becomes `category-freizeit-sport`.
114
+
- A `data-categories` attribute containing all categories as a comma-separated string.
115
+
- A `.eventCategories` div inside the event's `eventSub` area (visible in agenda view).
116
+
117
+
The module ships built-in colour rules for common English category names (`work`, `health`, `vacation`, `leisure`, `family`, `birthday`, `deadline`, `important`). Add your own in `css/custom.css`:
118
+
119
+
```css
120
+
/* Example – add to css/custom.css */
121
+
.CX2.event.category-sports {
122
+
border-left-color: #8bc34a;
123
+
background-color: rgb(13919574 / 12%);
124
+
}
125
+
.CX2.event.category-finance {
126
+
border-left-color: #ffc107;
127
+
background-color: rgb(2551937 / 12%);
128
+
}
129
+
```
130
+
131
+
Because categories are free-form text defined by your calendar, the class is derived from whatever your iCal files contain. The general selector below targets any event that carries at least one category:
0 commit comments