Fix dark mode: raise specificity of variable-defining dark blocks#190
Merged
oyvindberg merged 2 commits intomainfrom May 3, 2026
Merged
Fix dark mode: raise specificity of variable-defining dark blocks#190oyvindberg merged 2 commits intomainfrom
oyvindberg merged 2 commits intomainfrom
Conversation
The CSS minimizer was reordering rules so that `:root` ended up *after* `[data-theme="dark"]` in the bundled output. With matching specificity (0,1,0), source order wins — so the light `--typr-paper` value clobbered the dark one even when `data-theme="dark"` was set on `<html>`. Result: docs page didn't flip to dark mode at all, and the navbar stayed light. Fix: change the three variable-defining dark blocks to `html[data-theme="dark"]` (0,1,1). That beats `:root` regardless of how the bundler reorders. Also commit related theme-config tweaks that were sitting uncommitted: explicit colorMode config and announcement bar repainted in editorial ink/cream instead of the legacy purple.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
:rootand[data-theme="dark"]blocks in the production bundle so that:rootended up after[data-theme="dark"]. Both have specificity (0,1,0), so source order wins — the light--typr-paperclobbered the dark one even whendata-theme="dark"was set.custom.csstohtml[data-theme="dark"](specificity 0,1,1) makes them beat:rootregardless of bundler reordering.colorModeconfig and announcement bar repainted in editorial ink/cream instead of legacy purple.Test plan
npm run buildsucceeds; new bundle hash confirmednpx serve build) toggles dark mode on/and/typr/correctly