diff --git a/v2/src/lib/components/Workspace/SettingsTab.svelte b/v2/src/lib/components/Workspace/SettingsTab.svelte index 2e4e570..309d84b 100644 --- a/v2/src/lib/components/Workspace/SettingsTab.svelte +++ b/v2/src/lib/components/Workspace/SettingsTab.svelte @@ -15,7 +15,7 @@ import { deriveIdentifier } from '../../types/groups'; import { getSetting, setSetting } from '../../adapters/settings-bridge'; import { getCurrentTheme, setTheme } from '../../stores/theme.svelte'; - import { THEME_LIST, type ThemeId } from '../../styles/themes'; + import { THEME_LIST, getPalette, type ThemeId } from '../../styles/themes'; let activeGroupId = $derived(getActiveGroupId()); let activeGroup = $derived(getActiveGroup()); @@ -30,8 +30,9 @@ let defaultShell = $state(''); let defaultCwd = $state(''); let selectedTheme = $state(getCurrentTheme()); + let themeDropdownOpen = $state(false); - // Group themes by category for + // Group themes by category const themeGroups = $derived(() => { const map = new Map(); for (const t of THEME_LIST) { @@ -41,6 +42,10 @@ return [...map.entries()]; }); + let selectedThemeLabel = $derived( + THEME_LIST.find(t => t.id === selectedTheme)?.label ?? selectedTheme, + ); + onMount(async () => { const [shell, cwd] = await Promise.all([ getSetting('default_shell'), @@ -61,9 +66,23 @@ async function handleThemeChange(themeId: ThemeId) { selectedTheme = themeId; + themeDropdownOpen = false; await setTheme(themeId); } + function handleDropdownKeydown(e: KeyboardEvent) { + if (e.key === 'Escape') { + themeDropdownOpen = false; + } + } + + function handleClickOutside(e: MouseEvent) { + const target = e.target as HTMLElement; + if (!target.closest('.theme-dropdown')) { + themeDropdownOpen = false; + } + } + // New project form let newName = $state(''); let newCwd = $state(''); @@ -96,28 +115,60 @@ } -
+ + +

Global

- - +
+ {/if} +
- +
- +