ui: light theme by default (dark is opt-in)
Swaps the role of `:root` (now light) and the data-theme attribute (now `[data-theme="dark"]`) in cassandra.css, flips the localStorage fallback from 'dark' to 'light' in base/login/verify templates, and updates the theme-toggle label and the branding-consistency test selectors to match. Existing users with cassandra.theme=dark in localStorage still see dark — their explicit preference wins. Only first-time visitors and users with no stored preference shift to light. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9e058144ec
commit
89632e9937
6 changed files with 42 additions and 39 deletions
|
|
@ -44,17 +44,10 @@ def css_text() -> str:
|
|||
return CSS_PATH.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_dark_palette_matches_css(css_text):
|
||||
css_dark = _extract_vars(css_text, ":root")
|
||||
for key, expected in branding.DARK.items():
|
||||
actual = css_dark.get(key)
|
||||
assert actual == expected.lower(), (
|
||||
f"DARK[{key!r}] mismatch: branding.py={expected!r} vs css={actual!r}"
|
||||
)
|
||||
|
||||
|
||||
def test_light_palette_matches_css(css_text):
|
||||
css_light = _extract_vars(css_text, '[data-theme="light"]')
|
||||
# Light is the default — lives in `:root`. Dark is opt-in via the
|
||||
# data-theme attribute toggle.
|
||||
css_light = _extract_vars(css_text, ":root")
|
||||
for key, expected in branding.LIGHT.items():
|
||||
actual = css_light.get(key)
|
||||
assert actual == expected.lower(), (
|
||||
|
|
@ -62,6 +55,15 @@ def test_light_palette_matches_css(css_text):
|
|||
)
|
||||
|
||||
|
||||
def test_dark_palette_matches_css(css_text):
|
||||
css_dark = _extract_vars(css_text, '[data-theme="dark"]')
|
||||
for key, expected in branding.DARK.items():
|
||||
actual = css_dark.get(key)
|
||||
assert actual == expected.lower(), (
|
||||
f"DARK[{key!r}] mismatch: branding.py={expected!r} vs css={actual!r}"
|
||||
)
|
||||
|
||||
|
||||
def test_palette_keys_match_between_themes():
|
||||
"""If a colour is defined in dark, it must also be defined in light
|
||||
(and vice versa) — otherwise the theme switch leaves elements
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue