✨ Feat: F20.1 — dark theme following OS preference#524
Merged
Conversation
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.
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.
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.
Closes #521.
Summary
<head>bridge script mirrorsprefers-color-schemeonto<html data-bs-theme>and<html data-mantine-color-scheme>before first paint, and reacts to live OS toggles.$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.expandedtalkschannel theme.<AppMantineProvider defaultColorScheme="auto">replaces 17 bare<MantineProvider>mounts, so React islands match the surrounding chrome.docs/features.md.Strictly auto, per the issue: no toggle, no persistence, no
User.preferredTheme.Test plan
https://expandeddecks.wip— body, cards, tables, forms, and Mantine popovers should all render dark; navbar/footer stay deep navy with gold accent.https://expandedtalks.wip(channel theme).ArchetypeSelect/LanguageSelect), notification bell popover, navbar search combobox, login.Notes