From 85cf295edc165b065e91e8e624d88371111e671c Mon Sep 17 00:00:00 2001 From: scheinriese Date: Tue, 19 May 2026 23:28:52 +0200 Subject: [PATCH] refactor(icon): extract placeholder-hex constant for color picker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two no-input surfaces in the color picker pane used the same demo hex (#a1b2c3 / #A1B2C3) — the hex input's placeholder ghost text and react-colorful's SV pad starting position. Inconsistent casing on two literals separated by ~60 lines. Extract as a private constant with a docstring explaining the demo- value intent. Canonicalize on lowercase to match the rest of the codebase's hex convention; the input's placeholder renders visually identical either way since browsers don't case-discriminate hex. Co-Authored-By: Claude Opus 4.7 --- src/main/frontend/components/icon.cljs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/frontend/components/icon.cljs b/src/main/frontend/components/icon.cljs index f3ffa12b83..f64c644541 100644 --- a/src/main/frontend/components/icon.cljs +++ b/src/main/frontend/components/icon.cljs @@ -5645,6 +5645,14 @@ ;; for readability. Declaring silences the :undeclared-var warning. (declare recents-lane) +(def ^:private placeholder-hex + "Neutral grey-blue used in two no-input surfaces: the hex input's + placeholder ghost text (\"example of expected format\") and the + react-colorful SV pad's starting position when no color is set yet. + The a1/b2/c3 alphabetical pattern is the self-documentation — + it's a memorable demo value, not a designed color." + "#a1b2c3") + (rum/defc color-picker-pane "Custom-color picker pane shown below the swatch grid when the user clicks the rainbow tile. Hosts a hex input + react-colorful's @@ -5663,7 +5671,7 @@ ;; resolution succeeds (any kind of match). `picked` reflects only ;; exact-resolvable values for purposes of contrast indicator. resolved (colors/resolve-color hex-input) - active-color (or (:hex resolved) color "#a1b2c3") + active-color (or (:hex resolved) color placeholder-hex) ;; Compute the contrast-adjusted hex for BOTH light and dark themes ;; against canonical surfaces. This lets the indicator surface how ;; the pick will render in EACH mode, not just the current one — so @@ -5726,7 +5734,7 @@ {:ref *hex-ref :type "text" :value (or hex-input "") - :placeholder "#A1B2C3" + :placeholder placeholder-hex :spell-check false :auto-complete "off" :aria-label (t :icon.color/hex-aria-label)