mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 23:19:38 +00:00
refactor(icon): extract placeholder-hex constant for color picker
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user