Skip to content

feat(theme): add light/dark/system theme toggle#29

Merged
FreekBes merged 2 commits into
codam-coding-college:masterfrom
CheapFuck:feat/theme-toggle
Jun 24, 2026
Merged

feat(theme): add light/dark/system theme toggle#29
FreekBes merged 2 commits into
codam-coding-college:masterfrom
CheapFuck:feat/theme-toggle

Conversation

@CheapFuck

Copy link
Copy Markdown
Contributor

The dark theme was only driven by @media (prefers-color-scheme: dark). On Chromium-based browsers on Linux (e.g. Edge) the reported color scheme is the browser's own appearance setting, not the OS one, so a machine set to dark at the GNOME level could still render the light theme with no way for the user to override it.

Add a header toggle that cycles System -> Light -> Dark, persists the choice in localStorage, and is resolved by an inline script before first paint (no flash of the wrong theme). The script writes a concrete data-theme onto ; CSS now keys forced dark off :root[data-theme="dark"], while the prefers-color-scheme blocks remain as a no-JS fallback scoped to :root:not([data-theme]).

CheapFuck and others added 2 commits June 21, 2026 15:34
The dark theme was only driven by @media (prefers-color-scheme: dark).
On Chromium-based browsers on Linux (e.g. Edge) the reported color
scheme is the browser's own appearance setting, not the OS one, so a
machine set to dark at the GNOME level could still render the light
theme with no way for the user to override it.

Add a header toggle that cycles System -> Light -> Dark, persists the
choice in localStorage, and is resolved by an inline <head> script
before first paint (no flash of the wrong theme). The script writes a
concrete data-theme onto <html>; CSS now keys forced dark off
:root[data-theme="dark"], while the prefers-color-scheme blocks remain
as a no-JS fallback scoped to :root:not([data-theme]).
@FreekBes
FreekBes merged commit 960cfd6 into codam-coding-college:master Jun 24, 2026
1 check passed
@Codam-IT

Copy link
Copy Markdown

🎉 This PR is included in version 2.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

FreekBes pushed a commit to CheapFuck/codamhero-v2 that referenced this pull request Jun 24, 2026
@FreekBes FreekBes added the enhancement New feature or request label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants