Skip to content

Color settings: accept typed hex / rgb() values (#91)#97

Merged
petegordon merged 1 commit into
mainfrom
feat/91-color-text-entry
Jul 2, 2026
Merged

Color settings: accept typed hex / rgb() values (#91)#97
petegordon merged 1 commit into
mainfrom
feat/91-color-text-entry

Conversation

@petegordon

Copy link
Copy Markdown
Member

Summary

Closes #91 — add the ability to set colors by text value (hex or RGB), not just the native swatch picker.

Each of the 11 color settings now has a compact text field beside its swatch. It accepts:

  • Hex: #RRGGBB, #RGB, with or without the leading #
  • rgb(r,g,b) and rgba(r,g,b,a) (0–255 components; alpha ignored)

Input is normalized to #rrggbb and applied on Enter or blur. Invalid text is flagged red and not applied. Editing the native swatch keeps the text field in sync.

How it works

One generic pass over #settings-panel input[type="color"] wraps every picker (present and future). On a valid parse, the text field writes the normalized hex back to the swatch and dispatches the swatch's input event — so every existing per-picker apply + localStorage handler runs unchanged; no per-color wiring is duplicated.

Layout

  • 5 single-swatch rows: [ text ][swatch] on the right.
  • 2 grouped rows (Roll / Axis colors): label moves to its own line, then a full-width row of swatch-over-text cells so all three fit the 240px panel.

Changes

  • apps/overlay/src/index.html — CSS for .color-combo / .color-text / grouped .color-group; the two grouped rows get color-row-stacked + color-group classes.
  • apps/overlay/src/js/app.jsnormalizeColor() parser + attachColorText(), applied to all settings color inputs.

Test

  • normalizeColor() unit-checked against 14 cases (hex 3/6-digit, with/without #, rgb/rgba, whitespace, out-of-range → rejected, junk → rejected). All pass.
  • node --check apps/overlay/src/js/app.js passes.

🤖 Generated with Claude Code

Every color setting was a native <input type="color"> swatch only — no way to
paste or type an exact value. Add a synced text field beside each swatch that
accepts hex (#RGB / #RRGGBB, with or without '#') or rgb()/rgba(), normalizes
to #rrggbb, and applies on Enter/blur. Invalid input is flagged (red) and not
applied.

Implementation reuses each picker's existing apply+persist logic: on a valid
parse the text field writes the normalized hex back to the swatch and dispatches
its 'input' event, so no per-picker wiring is duplicated. The swatch→text sync
keeps the field current when the native picker is used. One generic pass over
`#settings-panel input[type="color"]` covers all 11 pickers (and any future
ones). The two grouped rows (Roll / Axis colors) stack their label above a
full-width row of swatch-over-text cells so all three fit the 240px panel.

Closes #91

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwZjBdVgWqxqCoKkXsZnr4
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

🔎 PR #97 preview — torn down

This PR is closed; its web preview and desktop prerelease have been removed.

@petegordon petegordon merged commit c80776b into main Jul 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Color settings, add the ability to add by text value

1 participant