Skip to content

feat(website): add a persistent light and dark theme switch - #2432

Merged
N0zoM1z0 merged 1 commit into
mainfrom
feat/website-theme-toggle
Oct 13, 2026
Merged

N0zoM1z0 merged 1 commit into
mainfrom
feat/website-theme-toggle

Conversation

@N0zoM1z0

Copy link
Copy Markdown
Collaborator

Add a sun/moon button beside the language selector. A first visit follows the system preference; a manual choice is remembered across pages, language editions and tabs on the same host. Keyboard users get a translated action label and a 44px button.

One shared head script applies the theme before styles load and owns the resolved theme, browser color and change event. The existing palettes, embedded SVGs and dinosaur canvas follow that choice. Storage failures leave the current-page switch usable; delayed cross-tab notifications read the latest saved value. Without JavaScript, pages remain light and the switch is hidden.

The shared page scaffold, maintenance guide and regression check cover the new theme region. Fix the Get started button's hover background to use the theme palette. Catalog changes add two reviewed labels in all 18 translations; existing translations are unchanged, and most PO changes are regenerated source references.

Validation:

  • website.py check: 12 regression tests; 325 HTML pages, 323 indexed routes and 20,793 local references verified.
  • Strict gettext coverage: all 18 catalogs contain 1,479 translations; GNU format checks pass and existing translation values are unchanged.
  • Chromium: 152 edition/layout/path/theme cases, plus 57 follow-up checks covering system changes, persistence, keyboard activation, blocked storage, delayed cross-tab notifications, no-JavaScript reading, all 17 reading pages and intermediate widths.
  • Rendered pixels confirm the dinosaur canvas and all five SVG figures follow manual theme overrides at both / and /rea/.
  • npm run check:fast, formatting and git diff --check pass.

@N0zoM1z0 N0zoM1z0 added enhancement New feature or request i18n Translations and localization workflow labels Oct 13, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@N0zoM1z0

Copy link
Copy Markdown
Collaborator Author

Self-review at 59a0ef81ed5cca15b2646a930f73ad9a791b619c. Codex automated review did not run because the repository review quota is exhausted.

Reviewed the final shared head/header templates, the theme state owner, CSS specificity, canvas consumer, generated HTML and catalog semantics.

  • Theme initialization runs before stylesheet parsing, including saved choices opposite to the system preference. Browser instrumentation confirmed this across both hosting paths and all editions.
  • System notifications only change the theme until a manual choice exists. Cross-tab notifications read current local storage rather than a potentially stale queued value; session-storage events are excluded.
  • Blocked reads, writes and storage getters preserve a usable in-page switch. Invalid persisted values fall back to the system preference.
  • Dark component rules use zero-specificity scoping so existing secondary-button and other component rules retain their precedence. The light palette remains the no-JavaScript fallback.
  • SVG media queries inherit the embedding page's resolved color scheme; actual browser-rendered pixels were checked. The dinosaur listens to the same theme change event and redraws when stopped.
  • The hidden button only becomes available after its localized accessible name and click handler exist. Space activation keeps focus and uses a 44px target.
  • Only two new runtime messages were added. All existing active translation values are unchanged; source-reference updates explain the large catalog diff.

Validation: 12 website regressions, strict 18-catalog coverage and GNU format checks, 152 Chromium matrix cases, 57 follow-up scenarios, formatting, typecheck/lint and diff checks pass. Browser execution used Chromium; other engines were not executed. No production publishing workflow was run.

@N0zoM1z0
N0zoM1z0 merged commit 4773c15 into main Oct 13, 2026
26 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/website-theme-toggle branch October 13, 2026 01:27
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request i18n Translations and localization workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant