Repository navigation
Keep tag colors readable on the dark theme - #1565
Merged
DavidMStraub merged 1 commit intoOct 19, 2026
Merged
Conversation
Tag chips use the tag color for text and outline. The default tag color in Gramps is black, which is almost invisible on dark surfaces. Add tagColorToCss(), which wraps the tag color in a relative oklch() color that clamps its lightness to --grampsjs-tag-lightness-min/-max, and set the minimum to 0.7 on the dark theme. Hue and chroma are kept, the light theme is unchanged, and browsers without relative color syntax get the plain color as before. Used by the tags manager, the tag chips of object pages and the media list. Fixes gramps-project#1310
Member
|
Thanks! |
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.
Linked issue
Closes #1310
What this changes
tagColorToCss()insrc/color.js: wraps the tag color in a relative color,oklch(from <color> clamp(var(--grampsjs-tag-lightness-min, 0), l, var(--grampsjs-tag-lightness-max, 1)) c h / alpha). Hue and chroma stay as they are, only the lightness is limited.global.csssets--grampsjs-tag-lightness-min: 0.7for the dark theme. The light theme defines no limits, so its tag colors are unchanged.tagColorToCss()instead ofcolorToCss()for text, outline and background tint.CSS.supports) get the plain color as before.With this, the default tag color black is shown as light grey on the dark theme; a red tag stays red with lightness 0.7 instead of 0.65.
How it was tested
test/unit/color.test.js: 4 new tests fortagColorToCss()(with and without relative color support, withoutCSS, invalid color).npm run lintandnpm test(63 files, 1180 tests) pass.#000000000000, Chromium 152, dark theme: in Administration → Tags the computed color of "Blog" isoklch(0.7 0 0 / 0.9)instead of black. On the light theme the computed colors of all three tags are unchanged (oklch(0 0 0 / 0.9)for "Blog"). The "ToDo" chip on person I0044 is clamped the same way on the dark theme.Before / after on the dark theme:
Drafted with an AI assistant.