diff --git a/src/renderer/src/assets/styles/base.css b/src/renderer/src/assets/styles/base.css index de81cc9..95a063d 100644 --- a/src/renderer/src/assets/styles/base.css +++ b/src/renderer/src/assets/styles/base.css @@ -18,11 +18,11 @@ body { -moz-osx-font-smoothing: grayscale; user-select: none; - /* Rich gradient base — visible through glass panels */ + /* Rich gradient base — accent-glow is set dynamically via JS */ background: - radial-gradient(ellipse 55% 45% at 12% 10%, rgba(168, 230, 0, 0.07) 0%, transparent 70%), - radial-gradient(ellipse 45% 55% at 88% 90%, rgba(0, 110, 220, 0.06) 0%, transparent 70%), - radial-gradient(ellipse 60% 40% at 50% 50%, rgba(100, 0, 180, 0.04) 0%, transparent 100%), + radial-gradient(ellipse 60% 50% at 15% 15%, var(--accent-glow, rgba(168,230,0,0.08)) 0%, transparent 70%), + radial-gradient(ellipse 45% 55% at 88% 90%, rgba(0, 110, 220, 0.05) 0%, transparent 70%), + radial-gradient(ellipse 60% 40% at 50% 50%, rgba(80, 0, 160, 0.04) 0%, transparent 100%), #09090e; } diff --git a/src/renderer/src/components/sidebar/AccountSwitcher.vue b/src/renderer/src/components/sidebar/AccountSwitcher.vue index 7b5c72c..fc3e714 100644 --- a/src/renderer/src/components/sidebar/AccountSwitcher.vue +++ b/src/renderer/src/components/sidebar/AccountSwitcher.vue @@ -14,7 +14,7 @@ function getInitial(email: string): string { } function getAccountColor(index: number): string { - const colors = ['#a8e600', '#00b4d8', '#e6a800', '#e066ff', '#ff6b6b', '#4ecdc4'] + const colors = ['#38bdf8', '#a78bfa', '#f472b6', '#fb923c', '#4ade80', '#f87171', '#2dd4bf'] return colors[index % colors.length] } diff --git a/src/renderer/src/stores/settings.store.ts b/src/renderer/src/stores/settings.store.ts index 7dd8646..bcf4934 100644 --- a/src/renderer/src/stores/settings.store.ts +++ b/src/renderer/src/stores/settings.store.ts @@ -17,32 +17,45 @@ export const SWIPE_ACTION_INFO: Record Math.min(255, c + amount).toString(16).padStart(2, '0')).join('') +} + +function getLuminance(r: number, g: number, b: number): number { + return 0.2126 * (r / 255) + 0.7152 * (g / 255) + 0.0722 * (b / 255) +} + +function applyAccentColor(hex: string): void { + const rgb = hexToRgb(hex) + if (!rgb) return + const [r, g, b] = rgb + const lum = getLuminance(r, g, b) + const root = document.documentElement + + root.style.setProperty('--accent', hex) + root.style.setProperty('--accent-hover', lightenHex(hex, 28)) + root.style.setProperty('--accent-muted', `rgba(${r},${g},${b},0.12)`) + root.style.setProperty('--accent-text', lum > 0.35 ? '#0d0d0d' : '#ffffff') + root.style.setProperty('--accent-glow', `rgba(${r},${g},${b},0.08)`) } // ─── Storage ───────────────────────────────────────────── @@ -51,7 +64,7 @@ const STORAGE_KEY = 'vue-mail-settings' function load(): { swipeLeftAction?: SwipeAction swipeRightAction?: SwipeAction - accentId?: string + accentColor?: string } { try { return JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '{}') @@ -65,15 +78,13 @@ export const useSettingsStore = defineStore('settings', () => { const swipeLeftAction = ref(saved.swipeLeftAction ?? 'delete') const swipeRightAction = ref(saved.swipeRightAction ?? 'toggleRead') - const accentId = ref(saved.accentId ?? 'lime') + const accentColor = ref(saved.accentColor ?? '#a8e600') - // Apply saved accent immediately on store init - const initPreset = ACCENT_PRESETS.find(p => p.id === accentId.value) ?? ACCENT_PRESETS[0] - applyAccent(initPreset) + // Apply on init + applyAccentColor(accentColor.value) - watch(accentId, (id) => { - const preset = ACCENT_PRESETS.find(p => p.id === id) ?? ACCENT_PRESETS[0] - applyAccent(preset) + watch(accentColor, (hex) => { + applyAccentColor(hex) persist() }) @@ -83,9 +94,9 @@ export const useSettingsStore = defineStore('settings', () => { localStorage.setItem(STORAGE_KEY, JSON.stringify({ swipeLeftAction: swipeLeftAction.value, swipeRightAction: swipeRightAction.value, - accentId: accentId.value, + accentColor: accentColor.value, })) } - return { swipeLeftAction, swipeRightAction, accentId } + return { swipeLeftAction, swipeRightAction, accentColor } }) diff --git a/src/renderer/src/views/SettingsView.vue b/src/renderer/src/views/SettingsView.vue index 18ac7ba..d6412d4 100644 --- a/src/renderer/src/views/SettingsView.vue +++ b/src/renderer/src/views/SettingsView.vue @@ -1,7 +1,7 @@