Skip to content

✨ Feat: F20.1 — dark theme following OS preference#524

Merged
jbourdin merged 2 commits intodevelopfrom
feature/F20.1-dark-theme-os-preference
May 6, 2026
Merged

✨ Feat: F20.1 — dark theme following OS preference#524
jbourdin merged 2 commits intodevelopfrom
feature/F20.1-dark-theme-os-preference

Conversation

@jbourdin
Copy link
Copy Markdown
Owner

@jbourdin jbourdin commented May 6, 2026

Closes #521.

Summary

  • Inline <head> bridge script mirrors prefers-color-scheme onto <html data-bs-theme> and <html data-mantine-color-scheme> before first paint, and reacts to live OS toggles.
  • Custom palette ($ed-navy/$ed-blue/$ed-gold/$ed-red/$ed-bg) exposed as --ed-* CSS custom properties with [data-bs-theme="dark"] overrides; targeted dark-mode rules for surfaces whose light recipe (rgba navy on white) doesn't translate.
  • Same dark-mode block added to the expandedtalks channel theme.
  • Single shared <AppMantineProvider defaultColorScheme="auto"> replaces 17 bare <MantineProvider> mounts, so React islands match the surrounding chrome.
  • F20 — Theming family added to docs/features.md.

Strictly auto, per the issue: no toggle, no persistence, no User.preferredTheme.

Test plan

  • Set macOS to dark (System Settings → Appearance → Dark) and reload https://expandeddecks.wip — body, cards, tables, forms, and Mantine popovers should all render dark; navbar/footer stay deep navy with gold accent.
  • Set macOS to light and reload — visual identity should be unchanged from before this PR.
  • With the page open, toggle macOS appearance — colours should flip without a refresh and without a flash of the wrong theme.
  • Repeat both states on https://expandedtalks.wip (channel theme).
  • Smoke-check: homepage, deck list, deck detail (mosaic), event detail, deck form (Mantine ArchetypeSelect / LanguageSelect), notification bell popover, navbar search combobox, login.
  • Run an axe / Lighthouse contrast check on a representative dark page per theme.

Notes

  • The dark palette here is intentionally restrained — F20.2 is the brand-level retheme (Dowsing-Machine-inspired) and will replace these provisional values.
  • I built the assets, ran eslint/stylelint/twig-cs/phpstan/lint-yaml/lint-container/lint-i18n/audit and the frontend test suite — all green. I did not open a real browser to visually confirm the dark mode; please verify the test plan above before merging.

Add a dark theme variant that auto-follows the OS prefers-color-scheme
setting on both the default and expandedtalks channel themes. Strictly
auto: no manual override, no user toggle, no persistence.

- Inline <head> bridge script in base.html.twig mirrors prefers-color-scheme
  onto data-bs-theme and data-mantine-color-scheme before first paint and
  reacts to live OS toggles. Bootstrap 5.3 and Mantine 8 read these
  attributes natively.
- Custom palette ($ed-navy/$ed-blue/$ed-gold/$ed-red/$ed-bg) mirrored as
  --ed-* CSS custom properties with [data-bs-theme="dark"] overrides so
  selectors that should react to the scheme can use var(--ed-*).
- Dark-mode rules for the few custom surfaces whose light recipe (rgba navy
  on white) doesn't translate: hero-pokemon, card-header-themed, table-themed
  thead, cms-content blockquote, rich-text tables, badges.
- Same dark-mode override block in themes/expandedtalks/_overrides.scss for
  the channel theme.
- Centralized Mantine provider via assets/components/AppMantineProvider.tsx
  with defaultColorScheme="auto" so all 17 React island entry points share
  one config and switch with the OS.
- Document F20 — Theming family and F20.1 in docs/features.md.
@sentry
Copy link
Copy Markdown

sentry Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The compile-time SCSS overrides at the top of app.scss ($card-bg: #fff,
$card-border-color: #ddd, $card-cap-bg: #f7f7f7, $table-striped-bg)
get burned into Bootstrap's component selectors as
`.card { --bs-card-bg: #fff }`, which has higher specificity than
`:root[data-bs-theme="dark"]`. Bootstrap's native dark mode for those
surfaces never fires, so cards stay white in dark mode while body text
adapts to light gray — light text on a white card is invisible.

Re-declare the affected CSS custom properties on the component selectors
(.card, .dropdown-menu, .modal-content, .popover, .list-group, .table,
.alert, .form-control, .form-select) under [data-bs-theme="dark"] so the
dark variant takes priority. Also point the themed card header active tab
to var(--bs-card-bg) instead of var(--bs-body-bg) so the active tab sits
flush with the (now-dark) card body.
@jbourdin jbourdin merged commit 3afd801 into develop May 6, 2026
6 checks passed
@jbourdin jbourdin deleted the feature/F20.1-dark-theme-os-preference branch May 6, 2026 07:26
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