Skip to content

Add dark mode with light/dark/system toggle#5

Merged
moberghammer merged 2 commits intomainfrom
cm/add-dark-mode
Mar 2, 2026
Merged

Add dark mode with light/dark/system toggle#5
moberghammer merged 2 commits intomainfrom
cm/add-dark-mode

Conversation

@moberghammer
Copy link
Member

@moberghammer moberghammer commented Mar 2, 2026

Summary

  • Adds class-based dark mode using TailwindCSS v4 @custom-variant dark (&.dark) — no build step needed
  • Theme toggle in the header cycles light → dark → system, persisted via localStorage
  • Blocking script in <head> prevents flash of wrong theme on page load
  • All templates updated with dark: class counterparts for backgrounds, text, borders, and severity row colors
  • Dynamic user/DB badge colors adjusted via CSS filter: brightness(1.3) saturate(0.85) in dark mode

Test plan

  • Toggle between light, dark, and system modes on each page (home, instance, process table)
  • Verify severity row colors (red/orange/yellow) remain distinguishable in dark mode
  • Verify dynamic User/DB badge colors are readable in dark mode
  • Reload page and confirm theme preference persists
  • Enable HTMX auto-refresh and confirm dark mode is maintained during partial swaps
  • Switch OS dark mode preference while set to "system" — should update automatically

🤖 Generated with Claude Code

moberghammer and others added 2 commits March 2, 2026 09:50
Uses TailwindCSS v4 class-based dark mode via @custom-variant.
Adds a persistent theme toggle (localStorage) in the header that
cycles light → dark → system, with a blocking script to prevent
flash of wrong theme. All templates get dark: class counterparts
for backgrounds, text, borders, and severity row colors. Dynamic
user/DB badge colors are adjusted via a CSS brightness filter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The @custom-variant selector (&.dark) only matched the <html> element
itself, not its descendants. Changed to (&:where(.dark, .dark *)) so
dark: utility classes on child elements are properly activated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@moberghammer moberghammer merged commit 9eaf715 into main Mar 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants