From faa2608a479257b9269b1deecd465997f7fdab31 Mon Sep 17 00:00:00 2001 From: Catherine Renelle <32781029+catrenelle@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:52:52 -0500 Subject: [PATCH] Fix ColorPicker solid color issues, add per-field reset, regroup accents ColorPicker fixes: - Color picker now initializes to default color instead of black when field is cleared/empty - Switching Solid<>Gradient no longer emits black; restores default color when switching back to Solid from a gradient value - No-op guard prevents re-emitting when clicking the already-active mode - Reset button now says "Reset to default" when a default is available - Text input placeholder shows the default value Branding page: - Accent Colors regrouped: Primary+hover and Danger+hover are stacked together, Success and Warning standalone in a 4-column grid - Mini preview fallbacks now use getDefault() helper instead of hardcoded values, keeping them in sync with the defaults map Co-Authored-By: Claude Opus 4.6 --- src/lib/components/ColorPicker.svelte | 16 ++++-- src/routes/admin/branding/+page.svelte | 74 ++++++++++++++------------ 2 files changed, 53 insertions(+), 37 deletions(-) diff --git a/src/lib/components/ColorPicker.svelte b/src/lib/components/ColorPicker.svelte index 992c866..adf274b 100644 --- a/src/lib/components/ColorPicker.svelte +++ b/src/lib/components/ColorPicker.svelte @@ -35,7 +35,8 @@ color = v; } else { mode = 'color'; - color = '#000000'; + // Show the default color in the picker when no custom value is set + color = defaultValue && defaultValue.startsWith('#') ? defaultValue : '#000000'; } }); @@ -50,15 +51,20 @@ } function switchMode(newMode: 'color' | 'gradient') { + if (mode === newMode) return; mode = newMode; if (newMode === 'color') { + // Restore from default if available, not leftover gradient state + if (!value || value.startsWith('linear-gradient') || value.startsWith('radial-gradient')) { + color = defaultValue && defaultValue.startsWith('#') ? defaultValue : '#000000'; + } emitColor(); } else { emitGradient(); } } - function clear() { + function resetToDefault() { value = ''; onchange?.(''); } @@ -68,7 +74,9 @@
{#if value} - + {:else if defaultValue} Default {/if} @@ -103,7 +111,7 @@ type="text" bind:value={color} oninput={emitColor} - placeholder="#000000" + placeholder={defaultValue || '#000000'} class="flex-1 rounded border border-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100 px-2 py-1 text-xs font-mono focus:border-[var(--color-primary)] focus:outline-none" />
diff --git a/src/routes/admin/branding/+page.svelte b/src/routes/admin/branding/+page.svelte index 77bb1d1..878a0a5 100644 --- a/src/routes/admin/branding/+page.svelte +++ b/src/routes/admin/branding/+page.svelte @@ -358,37 +358,45 @@

Accent Colors

-
- setField('primary', v)} - /> - setField('primaryHover', v)} - /> - setField('danger', v)} - /> - setField('dangerHover', v)} - /> +
+ +
+ setField('primary', v)} + /> + setField('primaryHover', v)} + /> +
+ +
+ setField('danger', v)} + /> + setField('dangerHover', v)} + /> +
+ setField('success', v)} /> + Preview
Pounce
@@ -421,13 +429,13 @@ {#each ['To Do', 'In Progress', 'Done'] as colTitle}
{colTitle}
{#each [1, 2] as _}
@@ -437,10 +445,10 @@
-
Primary
-
Danger
-
Success
-
Warning
+
Primary
+
Danger
+
Success
+
Warning