From 09533954236c58d1fae1cab6a54ab9e060e41436 Mon Sep 17 00:00:00 2001 From: Hibryda Date: Wed, 18 Mar 2026 01:43:22 +0100 Subject: [PATCH] feat(theme): add Theme Editor with live preview, import/export - ThemeEditor.svelte: 26 color pickers (14 accents + 12 neutrals) with native and hex text input, live CSS preview - custom-themes.ts: persistence layer (SQLite JSON blob), validation, import/export as JSON files, clone from any built-in theme - theme.svelte.ts: previewPalette/clearPreview for live editing, setCustomTheme for persistence, initTheme loads custom themes on startup - themes.ts: applyPaletteDirect + buildXtermThemeFromPalette + PALETTE_KEYS - AppearanceSettings.svelte: custom themes list with edit/delete, "New Custom Theme" button, ThemeEditor toggle - All files under 300 lines (296 + 227 + 98) --- src/lib/settings/ThemeEditor.svelte | 227 ++++++++++++++++++ .../categories/AppearanceSettings.svelte | 50 +++- src/lib/stores/theme.svelte.ts | 62 ++++- src/lib/styles/custom-themes.ts | 98 ++++++++ src/lib/styles/themes.ts | 25 +- 5 files changed, 454 insertions(+), 8 deletions(-) create mode 100644 src/lib/settings/ThemeEditor.svelte create mode 100644 src/lib/styles/custom-themes.ts diff --git a/src/lib/settings/ThemeEditor.svelte b/src/lib/settings/ThemeEditor.svelte new file mode 100644 index 0000000..f40e560 --- /dev/null +++ b/src/lib/settings/ThemeEditor.svelte @@ -0,0 +1,227 @@ + + +
+
+

Theme Editor

+
+ + +
+
+ + +
+
+ +
+
+ Accents ({ACCENT_KEYS.length}) +
+ {#each ACCENT_KEYS as key} +
+ + updateColor(key, (e.target as HTMLInputElement).value)} /> + handleHexInput(key, (e.target as HTMLInputElement).value)} /> +
+ {/each} +
+
+ +
+ Neutrals ({NEUTRAL_KEYS.length}) +
+ {#each NEUTRAL_KEYS as key} +
+ + updateColor(key, (e.target as HTMLInputElement).value)} /> + handleHexInput(key, (e.target as HTMLInputElement).value)} /> +
+ {/each} +
+
+
+ + +
+ + diff --git a/src/lib/settings/categories/AppearanceSettings.svelte b/src/lib/settings/categories/AppearanceSettings.svelte index d974f1a..adabec9 100644 --- a/src/lib/settings/categories/AppearanceSettings.svelte +++ b/src/lib/settings/categories/AppearanceSettings.svelte @@ -1,9 +1,11 @@