mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 03:29:25 +01:00
Add a warm charcoal dark mode ("Night Ops") using CSS variable swapping
under [data-theme="dark"]. All 23 desert palette variables are overridden
with dark-mode counterparts, and ~313 generic Tailwind classes (bg-white,
text-gray-*, border-gray-*) are replaced with semantic tokens.
Infrastructure:
- CSS variable overrides in app.css for both themes
- ThemeProvider + useTheme hook (localStorage + KV store sync)
- ThemeToggle component (moon/sun icons, "Night Ops"/"Day Ops" labels)
- FOUC prevention script in inertia_layout.edge
- Toggle placed in StyledSidebar and Footer for access on every page
Color replacements across 50 files:
- bg-white → bg-surface-primary
- bg-gray-50/100 → bg-surface-secondary
- text-gray-900/800 → text-text-primary
- text-gray-600/500 → text-text-secondary/text-text-muted
- border-gray-200/300 → border-border-subtle/border-border-default
- text-desert-white → text-white (fixes invisible text on colored bg)
- Button hover/active states use dedicated btn-green-hover/active vars
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
855 B
TypeScript
25 lines
855 B
TypeScript
import { IconSun, IconMoon } from '@tabler/icons-react'
|
|
import { useThemeContext } from '~/providers/ThemeProvider'
|
|
|
|
interface ThemeToggleProps {
|
|
compact?: boolean
|
|
}
|
|
|
|
export default function ThemeToggle({ compact = false }: ThemeToggleProps) {
|
|
const { theme, toggleTheme } = useThemeContext()
|
|
const isDark = theme === 'dark'
|
|
|
|
return (
|
|
<button
|
|
onClick={toggleTheme}
|
|
className="flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors
|
|
text-desert-stone hover:text-desert-green-darker"
|
|
aria-label={isDark ? 'Switch to Day Ops' : 'Switch to Night Ops'}
|
|
title={isDark ? 'Switch to Day Ops' : 'Switch to Night Ops'}
|
|
>
|
|
{isDark ? <IconSun className="size-4" /> : <IconMoon className="size-4" />}
|
|
{!compact && <span>{isDark ? 'Day Ops' : 'Night Ops'}</span>}
|
|
</button>
|
|
)
|
|
}
|