feat: add light/dark mode to theme gallery#95
Merged
Conversation
Adds system-preference-aware light and dark mode to the gallery. Defaults to the OS preference (prefers-color-scheme), with a manual "Theme: Dark/Light" toggle button in the header that persists the choice to localStorage. Moves all previously hardcoded colours into CSS custom properties so both themes are fully theme-aware. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces hardcoded white rgba dot colours with --dot, --dot-hover, and --dot-active CSS variables that switch to black equivalents in light mode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The lightbox overlay is always dark, but title/close/nav/counter were using theme vars that go light in light mode, making them invisible. Adds --lb-fg, --lb-fg-muted, --lb-btn-bg, --lb-btn-border vars (defined once in :root, not overridden by light theme) so lightbox elements are always readable against the dark scrim. Co-Authored-By: Claude Sonnet 4.6 <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
prefers-color-schemesettinglocalStorageWhat changed
All changes are in
tools/generate_site.py(the generator);site/index.htmlis a generated artifact and will be rebuilt by CI.CSS: New
--card-hover-border,--carousel-bg,--carousel-placeholder-bg,--btn-hover-bg,--dl-theme-color,--dl-theme-border, and--swatch-bordervariables added to both the dark:rootblock and a new:root[data-theme="light"]block. A@media (prefers-color-scheme: light)block applies light values automatically when the user has no saved preference.HTML:
<button id="theme-toggle">added to the header, reusing the existing.anim-togglestyle.JS: A small
applyTheme()function setsdata-themeon<html>, updates the button label, and persists tolocalStorage— matching the same pattern used by the animation toggle.Test plan
site/index.htmllocally (runpython3 tools/generate_site.py --themes-dir THEMES --output-dir site)localStorage🤖 Generated with Claude Code