diff --git a/src/uix/eidos/components/words/words-drawer.svelte b/src/uix/eidos/components/words/words-drawer.svelte index d3464dabd..cc4a303f0 100644 --- a/src/uix/eidos/components/words/words-drawer.svelte +++ b/src/uix/eidos/components/words/words-drawer.svelte @@ -94,6 +94,32 @@ { id: 'bash', label: 'Bash' }, { id: 'python', label: 'Py' } ] as const; + + /** Hand-picked palette — keeps the picker compact while covering + * most editorial intents. Free hex still available via the input + * next to the chips. */ + const COLOR_PRESETS = [ + '#ef4444', // red + '#f97316', // orange + '#eab308', // amber + '#22c55e', // green + '#06b6d4', // cyan + '#3b82f6', // blue + '#8b5cf6', // violet + '#ec4899', // pink + '#ffffff', // white + '#a1a1aa' // grey + ] as const; + + /** Read the parametric mark value for a given prefix from the + * active marks. Returns '' when not set. */ + function currentParametricMark( + marks: readonly string[], + prefix: 'color' | 'bgcolor' + ): string { + const found = marks.find((m) => m.startsWith(`${prefix}:`)); + return found ? found.slice(prefix.length + 1) : ''; + } @@ -268,6 +294,78 @@ {/each} +
Foreground
+
+ {#each COLOR_PRESETS as preset (preset)} + + {/each} + { + const v = (e.currentTarget as HTMLInputElement).value; + s.runCommand(`color:${v}` as never); + }} + /> + {#if currentParametricMark(s.activeMarks, 'color')} + + {/if} +
+ +
Background
+
+ {#each COLOR_PRESETS as preset (preset)} + + {/each} + { + const v = (e.currentTarget as HTMLInputElement).value; + s.runCommand(`bgcolor:${v}` as never); + }} + /> + {#if currentParametricMark(s.activeMarks, 'bgcolor')} + + {/if} +
+