diff --git a/frontend/src/pages/Preferences.tsx b/frontend/src/pages/Preferences.tsx index 9ef35d6..dc1cf28 100644 --- a/frontend/src/pages/Preferences.tsx +++ b/frontend/src/pages/Preferences.tsx @@ -1,4 +1,4 @@ -import { Sun, Monitor, Moon } from 'lucide-react' +import { Sun, Monitor, Moon, Pipette } from 'lucide-react' import { clsx } from 'clsx' import { useThemeStore, ACCENT_PRESETS, type ThemeMode } from '../store/theme' @@ -9,7 +9,7 @@ const MODES: { key: ThemeMode; icon: typeof Sun; label: string }[] = [ ] export default function PreferencesPage() { - const { mode, accent, setMode, setAccent } = useThemeStore() + const { mode, accent, customHex, setMode, setAccent, setCustomHex } = useThemeStore() return (
@@ -54,7 +54,8 @@ export default function PreferencesPage() {

Accent color

Used for buttons, links, and highlights

-
+
+ {/* Preset swatches */} {ACCENT_PRESETS.map(({ key, label, hex }) => ( + + {/* Color picker + hex input (when custom is active) */} + {accent === 'custom' && ( +
+ setCustomHex(e.target.value)} + className="w-8 h-8 rounded-lg border border-border-default cursor-pointer p-0" + title="Pick a custom accent color" + /> + { + const v = e.target.value + if (/^#[0-9a-fA-F]{6}$/.test(v)) setCustomHex(v) + }} + onBlur={(e) => { + let v = e.target.value + if (!v.startsWith('#')) v = '#' + v + if (/^#[0-9a-fA-F]{6}$/.test(v)) setCustomHex(v) + }} + className="w-24 px-2 py-1.5 text-sm font-mono border border-border-default rounded-lg bg-surface text-content focus:outline-none focus:border-accent" + placeholder="#6366f1" + /> +
+ )}