Skip to content

Add status page theme mode setting and toggle - #479

Open
devmitulpatel wants to merge 6 commits into
cachethq:mainfrom
devmitulpatel:theme-mode-toggle
Open

devmitulpatel wants to merge 6 commits into
cachethq:mainfrom
devmitulpatel:theme-mode-toggle

Conversation

@devmitulpatel

Copy link
Copy Markdown

Closes #68.

This picks up the work from claude/status-page-theme-options-27npnb, rebases it onto main, and adapts the metrics theme handling to the extracted resources/js/metrics.js. The first two commits keep their original authorship from that branch.

Changes

  • Adds a theme.theme_mode setting (auto, light, dark) with an Appearance section on the Manage Theme page.
  • auto keeps following each visitor's system preference and shows a Light/System/Dark toggle in the status page header, persisted in localStorage.
  • Forced light/dark renders the status page in that scheme and hides the toggle.
  • Dark mode is class-based (dark/light on <html>) with a prefers-color-scheme fallback so system dark mode still works without JavaScript.
  • Metrics charts repaint on the theme-changed event.

Verification

  • composer test:unit — 1159 passed
  • vendor/bin/pint --test — clean
  • vendor/bin/phpstan analyse — no errors
  • vendor/bin/pest tests/Browser/ThemeToggleTest.php — 7 passed

claude and others added 4 commits October 5, 2026 16:38
Adds a theme.theme_mode setting (automatic, light, or dark) that is
managed from an Appearance section on the Manage Theme dashboard page.
In automatic mode, visitors get a light/system/dark toggle in the
status page header, persisted in localStorage and defaulting to their
system preference. Forcing light or dark locks the status page to that
scheme and hides the toggle.

Dark mode now uses a class strategy (.dark/.light on the html element)
with a prefers-color-scheme fallback so system dark mode still works
without JavaScript. Metric charts re-style through a theme-changed
event when the applied theme changes.

Closes cachethq#68

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CWXnTksjtcUCDPwyoWeDe
Adds pestphp/pest-plugin-browser and a browser test suite exercising
the theme toggle end-to-end: system preference resolution, picking and
persisting a theme, returning to the system theme, invalid stored
preferences, and forced light/dark modes hiding the toggle. CI test
jobs now install the Playwright browser needed to run them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018CWXnTksjtcUCDPwyoWeDe
The metrics chart script moved out of the Blade template into its own
asset, so the theme mode changes need to live there. Charts now resolve
dark mode from the html class (falling back to the system preference)
and repaint when the theme-changed event fires.
@devmitulpatel

Copy link
Copy Markdown
Author

Screenshots of the status page in automatic mode, following the OS preference. Forced light/dark additionally hides the header toggle.

Light:

Theme light

Dark:

Theme dark

@jbrooksuk

Copy link
Copy Markdown
Member

Thanks for picking this up and sorry for the delay in getting back to you! Three things I’d like fixed before merging:

  • The header and status overview still follow the OS colour scheme. I reproduced both directions in Chrome: choosing Dark on a light OS leaves those surfaces white with light text, and choosing Light on a dark OS leaves them dark. Could you use the class-aware dark variant for those styles and add a browser assertion for the computed background in both directions?
  • The theme picker is exposed as a radio group, but all three options are separate Tab stops and the arrow keys don’t move between them. Should we use native radio inputs or add the standard radio-group keyboard behaviour?
  • I think the theme changer should live left of the Dashboard button, and it should be in keeping with the design. I think a button that toggles through light, dark & system.

jbrooksuk and others added 2 commits November 30, 2026 20:03
Use one borderless cycling button next to Dashboard and preserve a
visible keyboard focus outline. Apply the selected mode to the header,
overview, and status summary even when the system preference differs.
Cover both override directions in the browser tests.

Amp-Thread-ID: https://ampcode.com/threads/T-01a22d2b-8929-75f8-84c9-0797e65ef354
Co-authored-by: Amp <amp@ampcode.com>
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.

Toggle Light / Dark Mode

3 participants