Skip to content

fix: theme must own both light and dark values for every primitive it sets - #9

Merged
LukasHirt merged 1 commit into
mainfrom
fix-theme-explicit-layer-order
Sep 25, 2026
Merged

LukasHirt merged 1 commit into
mainfrom
fix-theme-explicit-layer-order

Conversation

@LukasHirt

Copy link
Copy Markdown
Contributor

Fixes two regressions from the previous theme fix, both root-caused and verified in an actual browser this time:

  1. Cross-layer priority ignores selector specificity entirely, so once this file's dark-mode values sat in a higher-priority layer than Starlight's own, they permanently beat Starlight's lower-priority light-mode values for every primitive touched here - breaking the light/dark switch again, just for surfaces instead of accent. Fixed by explicitly setting both themes' values for every primitive this file touches, rather than relying on Starlight's own conditional logic to fill in one theme.
  2. A color-mix() call had its percentages backwards (35% orange + 65% white reads as pale pink, not a lighter orange). Flipped to 80% orange.

… sets

The previous commit's explicit @layer ordering fixed the accent-color
regression, but introduced a new one: a higher-priority layer beats a
lower-priority one regardless of selector specificity, so this file's
dark-mode :root values kept beating Starlight's own, lower-priority
:root[data-theme='light'] values for every primitive touched here -
the light/dark switch broke again, this time for surfaces rather than
accent. Also fixes a color-mix() percentage that was backwards
(color-mix(in srgb, #ff6b4a 35%, white) mixes 35% orange with 65%
white, reading as pale pink rather than a lighter orange - flipped to
80% orange, 20% white).

This file now explicitly sets both themes' values for every primitive
it touches, copying Starlight's own default light-mode primitives
verbatim rather than leaning on its lower-priority layer to supply
them. Verified both themes, the search dialog, and the accent color on
buttons/links in an actual browser before pushing.

Signed-off-by: Lukas Hirt <info@hirt.cz>
@LukasHirt
LukasHirt merged commit 1ab7d6f into main Sep 25, 2026
6 checks passed
@LukasHirt
LukasHirt deleted the fix-theme-explicit-layer-order branch September 25, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant