Skip to content

feat(color-picker): migrate to @simonwep/pickr - #3151

Open
deadlyjack wants to merge 2 commits into
mainfrom
feat/pickr-color-picker
Open

deadlyjack wants to merge 2 commits into
mainfrom
feat/pickr-color-picker

Conversation

@deadlyjack

Copy link
Copy Markdown
Member

Replace vanilla-picker with an inline Pickr dialog, add recent color swatches with format cycling, validate and migrate stored colors, and round fractional alpha in Hex.fromRgb. Add unit tests for swatch storage/migration and hex alpha rounding.

Replace vanilla-picker with an inline Pickr dialog, add recent color swatches with format cycling, validate and migrate stored colors, and round fractional alpha in Hex.fromRgb. Add unit tests for swatch storage/migration and hex alpha rounding.
@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; the remaining migration-test gap is non-blocking.

Findings

  1. P2 Migration test skips color conversion ▶

Summary

Replaces vanilla-picker with an inline Pickr dialog.

  • The color dialog uses an inline picker with HEX, RGB, and HSL controls.
  • Recent color swatches keep confirmed choices ready for reuse.
  • Color values keep their opacity across HEX, RGB, and HSL formats.

The latest changes address the earlier opacity finding. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "refactor(color-picker): extract formatCo..." · Reviewed by Greptile

greptile-apps[bot]

This comment was marked as outdated.

Move Pickr color formatting into a pure module, quantize alpha through the 8-bit channel so faint colors stay translucent, and reuse the formatter for stored hex colors. Add focused tests for every format and the alpha round-trip.
@deadlyjack

Copy link
Copy Markdown
Member Author

@greptile

Comment on lines +21 to +23
const [first, second, third] = (isHsl ? hsva.toHSLA() : hsva.toRGBA()).map(
Math.round,
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rounding HSL channels to whole numbers changes the picked colour. For example, #123456 becomes hsl(210, 65%, 20%), which is #123354. Opening an existing hsl(210, 65.4%, 20.4%) and tapping OK also changes it, and the recent swatch keeps the exact hex, so it no longer matches the inserted text.

vanilla-picker kept one decimal. I compared both roundings over ~636k RGB colours: one decimal round-trips all of them, while whole numbers change about 89% (by up to 5/255 per channel).

Suggested change
const [first, second, third] = (isHsl ? hsva.toHSLA() : hsva.toRGBA()).map(
Math.round,
);
const [first, second, third] = isHsl
? hsva.toHSLA().map((value) => Number(value.toFixed(1)))
: hsva.toRGBA().map(Math.round);

A test with a non-integer HSL colour such as #123456 would cover this.

Comment thread src/dialogs/color.scss
&::after {
content: "";
position: absolute;
inset: 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Minor: inset needs Chrome 87, but we support WebView 67+ and autoprefixer doesn't expand it. On Chrome 67–86 these pseudo-elements should collapse to 0×0, leaving the recent swatches and the preview circle with no colour.

Suggested change
inset: 0;
top: 0;
right: 0;
bottom: 0;
left: 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants