From 9a9464a8de42c6d5f598230e4bce736b73b53c54 Mon Sep 17 00:00:00 2001 From: jevb Date: Fri, 27 Mar 2026 12:09:47 +0100 Subject: [PATCH] feat: add neon-glow to theme selector and apply body class on theme switch - Add "neon-glow" entry to THEMES in settings/helpers.ts - Update applyTheme() to also toggle theme- class on document.body - Update UiState and setTheme() in ui.store.ts to include "neon-glow" --- Client/tauri-client/src/components/settings/helpers.ts | 5 +++++ Client/tauri-client/src/stores/ui.store.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Client/tauri-client/src/components/settings/helpers.ts b/Client/tauri-client/src/components/settings/helpers.ts index 1129e5e7..3517fdff 100644 --- a/Client/tauri-client/src/components/settings/helpers.ts +++ b/Client/tauri-client/src/components/settings/helpers.ts @@ -12,6 +12,7 @@ export const STORAGE_PREFIX = "owncord:settings:"; export const THEMES = { dark: { "--bg-primary": "#313338", "--bg-secondary": "#2b2d31", "--bg-tertiary": "#1e1f22", "--text-normal": "#dbdee1" }, + "neon-glow": { "--bg-primary": "#1a1b1e", "--bg-secondary": "#111214", "--bg-tertiary": "#0d0e10", "--text-normal": "#dbdee1" }, midnight: { "--bg-primary": "#1a1a2e", "--bg-secondary": "#16213e", "--bg-tertiary": "#0f3460", "--text-normal": "#e0e0e0" }, light: { "--bg-primary": "#ffffff", "--bg-secondary": "#f2f3f5", "--bg-tertiary": "#e3e5e8", "--text-normal": "#313338" }, } as const; @@ -90,4 +91,8 @@ export function applyTheme(name: ThemeName): void { for (const [prop, val] of Object.entries(vars)) { root.style.setProperty(prop, val); } + for (const cls of [...document.body.classList]) { + if (cls.startsWith("theme-")) document.body.classList.remove(cls); + } + document.body.classList.add(`theme-${name}`); } diff --git a/Client/tauri-client/src/stores/ui.store.ts b/Client/tauri-client/src/stores/ui.store.ts index ec2aec67..bf3c82a8 100644 --- a/Client/tauri-client/src/stores/ui.store.ts +++ b/Client/tauri-client/src/stores/ui.store.ts @@ -10,7 +10,7 @@ export interface UiState { readonly memberListVisible: boolean; readonly settingsOpen: boolean; readonly activeModal: string | null; - readonly theme: "dark" | "midnight" | "light"; + readonly theme: "dark" | "neon-glow" | "midnight" | "light"; readonly connectionStatus: "connected" | "reconnecting" | "disconnected"; readonly transientError: string | null; readonly persistentError: string | null; @@ -84,7 +84,7 @@ export function closeModal(): void { } /** Set the UI theme. */ -export function setTheme(theme: "dark" | "midnight" | "light"): void { +export function setTheme(theme: "dark" | "neon-glow" | "midnight" | "light"): void { uiStore.setState((prev) => ({ ...prev, theme,