Expose calendar color as a CSS custom property (--cal-color) - #73
Merged
ralflang merged 1 commit intoJul 21, 2026
Merged
Conversation
Kronolith sets each calendar's color as an inline background-color on events, the legend and sidebar entries. That inline value cannot be reused from CSS: a theme cannot derive tints/tones/borders from it (no way to read an inline background-color into a color-mix()/calc() expression). Themes are therefore stuck with the flat, fully-saturated color as the event background. In addition to the existing inline background-color/color, expose the raw calendar color as a --cal-color custom property on the same elements: events (month/week/day/agenda), the print legend, and sidebar calendar/tasklist entries, including on live recolor (saveCalendarCallback). Non-breaking: it only adds a custom property; existing inline styles are untouched and default rendering is identical. No existing theme references --cal-color, so nothing changes visually unless a theme opts in. It gives themes a clean hook to style events by color, e.g. the modern "event pill" look (light tinted background + darker same-hue text + colored accent).
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a theming hook by exposing each calendar’s raw background color as a CSS custom property (--cal-color) on the same UI elements that already receive inline background-color/color styles. This enables themes to derive tints/tones/borders from the calendar color (e.g., via color-mix()), without changing the default rendering.
Changes:
- Set
--cal-coloron sidebar calendar/tasklist rows when inserting them into the list. - Set
--cal-coloron print legend entries when adding legend items. - Set
--cal-coloron event elements across views (day/week/workweek, month, agenda) and update it during live recolor (saveCalendarCallback).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Thank you, I like that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
Kronolith sets each calendar's color directly as an inline
background-color(and
color) on events, the legend and sidebar entries. That inline value isnot reusable from CSS: a theme cannot derive tints, tones or borders from it,
because there is no way to read an inline
background-colorback into acolor-mix()/calc()expression.As a result, themes are stuck with the flat, fully-saturated calendar color as
the event background. They cannot implement the now-common "event pill" look
(light tinted background + darker same-hue text + colored accent) used by Google
Calendar, Outlook Web and most modern calendar UIs.
Change
In addition to the existing inline
background-color/color, also expose theraw calendar color as a CSS custom property
--cal-coloron the same elements:events (month / week / day / agenda), the print legend, and sidebar
calendar/tasklist entries — including on live recolor (
saveCalendarCallback),so themes relying on it update immediately without a reload.
Why this is safe / non-breaking
It only adds a custom property; the existing
background-color/colorinline styles are untouched. Default rendering is byte-for-byte identical.
No existing theme references
--cal-color, so nothing changes visuallyanywhere unless a theme opts in.
It gives themes a clean hook to style events by color, e.g.:
Example
Below: the UPJV theme using
--cal-colorto render events, the legend and thesidebar as tinted pills — impossible today because the color is locked in an
inline
background-color. (Screenshot added in a comment.)