Skip to content

feat: add light/dark mode to theme gallery#95

Merged
pfeerick merged 3 commits intomainfrom
feat/gallery-light-dark-mode
Apr 23, 2026
Merged

feat: add light/dark mode to theme gallery#95
pfeerick merged 3 commits intomainfrom
feat/gallery-light-dark-mode

Conversation

@pfeerick
Copy link
Copy Markdown
Member

@pfeerick pfeerick commented Apr 23, 2026

Summary

  • Adds system-preference-aware light and dark mode to the gallery, defaulting to the OS prefers-color-scheme setting
  • Adds a Theme: Dark / Theme: Light toggle button in the header (alongside the existing Animations and Reset buttons) that persists the choice to localStorage
  • Moves all previously hardcoded colours into CSS custom properties so both themes are fully theme-aware (carousel backgrounds, hover states, swatch borders, download button colours, etc.)

What changed

All changes are in tools/generate_site.py (the generator); site/index.html is 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-border variables added to both the dark :root block 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-toggle style.

JS: A small applyTheme() function sets data-theme on <html>, updates the button label, and persists to localStorage — matching the same pattern used by the animation toggle.

Test plan

  • Open site/index.html locally (run python3 tools/generate_site.py --themes-dir THEMES --output-dir site)
  • Verify the page defaults to the OS colour scheme
  • Click the toggle — page switches between dark and light modes
  • Reload — saved preference is restored from localStorage
  • Check cards, carousels, search input, lightbox, and colour swatches in both modes

🤖 Generated with Claude Code

pfeerick and others added 3 commits April 23, 2026 14:39
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>
@pfeerick pfeerick merged commit 06773f4 into main Apr 23, 2026
3 checks passed
@pfeerick pfeerick deleted the feat/gallery-light-dark-mode branch April 23, 2026 05:14
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