Add dark mode with Light, Dark and System choices - #119
Merged
Merged
Conversation
A header button cycles Light, Dark and System, closing #117. The choice is saved in localStorage; System, the default, follows the OS setting and switches live when it changes. Minima 2.5 compiles its colors into the CSS and runs lighten/darken on them, so dark mode is a set of override rules scoped to html[data-theme=dark]. The light CSS is unchanged. An inline script in <head> sets the theme before first paint so dark visitors see no light flash, and without JavaScript the page follows the OS through prefers-color-scheme. Dark code blocks use rouge's github.dark colors, and every text and background pair meets WCAG AA contrast. Co-Authored-By: Claude Opus 5 <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.
Closes #117.
What
aria-labelshow the current choice.localStorage. System is the default and follows the OS setting, switching live when it changes.theme-color) is#424242in light, as before, and#1b1b1din dark.How
lighten/darkenon them, so its variables can't become CSS custom properties. Dark mode is a set of override rules underhtml[data-theme="dark"]in_sass/dark-theme.scss._includes/head.htmlsetsdata-themebefore the stylesheet paints, so there is no light flash.assets/js/theme.jshandles the button, the OSchangeevent and syncing across tabs.prefers-color-schememedia query follows the OS.github.darkcolors (_sass/_syntax-dark.scss). The dark palette meets WCAG AA contrast (text 13.4:1, links 7.1:1, meta 6.6:1).html.theme-transition), never on page load.Verification
./scripts/testpasses (build + htmlproofer).main.csscompared with master: 0 lines removed or changed, only additions, so light mode is unchanged.theme-color.🤖 Generated with Claude Code