Skip to content

Add color swatches to the Main color setting - #24

Open
WalnutDerwin wants to merge 2 commits into
paulovieira:mainfrom
WalnutDerwin:feat/main-color-swatches
Open

Add color swatches to the Main color setting#24
WalnutDerwin wants to merge 2 commits into
paulovieira:mainfrom
WalnutDerwin:feat/main-color-swatches

Conversation

@WalnutDerwin

@WalnutDerwin WalnutDerwin commented Jul 22, 2026

Copy link
Copy Markdown

Context

The Main color setting currently lists color names without an in-product visual cue. Users need to remember the Tailwind palette or consult the external palette reference before choosing a hue.

Reproduction

  1. Open Settings → Extension Settings → Reference Path.
  2. Open the Main color control.

Actual behavior

The control displays only text labels, so users cannot visually identify a candidate color before selecting it.

Expected behavior

Each candidate should include a small color indicator so users can quickly recognize the main hue before choosing it.

Root cause

The existing control is a native select. Its browser-controlled option popup cannot reliably render custom HTML/CSS content, so it cannot show a swatch for every option.

Improvement

  • Replace the native select with a custom React settings component.
  • Keep the 22 original persisted color values and reuse the existing settings update path.
  • Show one circular swatch beside the selected color and every candidate.
  • Use the candidate's Tailwind 500 shade for all swatches. This is deliberately a stable hue identifier, not a preview of the independently configured bullet, reference, or line shades.
  • Put static picker styling in extension.css and keep only settings-dependent reference-path styles dynamic.

Verification

  • Confirmed the picker renders color swatches and the option list remains scrollable.
  • Confirmed selecting a color updates the reference path immediately without flashing.
  • Confirmed the selected color remains available after reopening/reloading the settings.
  • Ran git diff --check.
  • Ran a JavaScript syntax check.
  • Verified the fixed 500 mapping for all 22 color candidates.

Screenshot

image

Replace the native select with a custom settings picker so every
candidate shows a fixed 500-shade swatch.

The swatches identify each hue only; bullets, references, and lines
keep their independent shade settings. Preserve the existing color
values and settings update path.
Copilot AI review requested due to automatic review settings July 22, 2026 00:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the “Main color” native select with a custom React-based picker so each color option can display a swatch (using Tailwind’s 500 shade), while keeping the persisted setting values compatible with existing user configs.

Changes:

  • Introduces MainColorPicker and internals.colorOptions, and wires the “Main color” setting to a reactComponent.
  • Adds getColorPreviewHex() for stable swatch rendering based on a fixed 500 shade.
  • Moves static picker presentation styles into a new extension.css and tags dynamic style elements so they can be selectively reset.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
extension.js Adds the custom React main-color picker, fixed swatch color mapping, and dynamic-style tagging/removal logic.
extension.css Adds static CSS needed for picker layout and swatch sizing/styling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extension.js Outdated
Comment thread extension.js Outdated
Comment thread extension.js
Comment thread extension.js
Keep removing dynamic styles created before the marker was introduced
without allowing the cleanup to remove the static picker stylesheet.

Use native buttons and a named group rather than advertising listbox
or menu keyboard behavior that the picker does not implement.
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.

2 participants