Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: react ColorSlider hue gradient #31238

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yoonbuck
Copy link
Member

The background gradient used by the hue slider of ColorPicker does not accurately represent a gradient through hues with constant saturation/lightness because it is created with 10 stops instead of the 6 primary/secondary stops needed to correctly represent the hue gradient using RGB interpolation.

In particular, the current gradient has incorrect muddy lightness dips around fuchsia and yellow and (less noticeable) lightness bumps around lime and blue.

Two horizontal rainbow gradients. The upper one has marks every tenth of the way along and is slightly different in the yellow and fuchsia areas than the lower one, which has marks every sixth of the way along.

Upper: current hue gradient (10 stops)
Lower: correct hue gradient (6 stops)

Previous Behavior

Full color picker, with the hue slider resembling the top gradient above

New Behavior

Full color picker, with the hue slider resembling the bottom gradient above

Copy link

codesandbox-ci bot commented Apr 30, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

The background gradient used by the hue slider of ColorPicker does not
accurately represent a gradient through hues with constant saturation/
lightness because it is implemented with 10 stops instead of the 6
primary/secondary stops needed to correctly represent the hue gradient
with an RGB interpolation.

In particular, the current gradient has incorrect lightness dips around
fuchsia and yellow and (less noticeable) lightness bumps around lime and
blue.
Comment on lines +8 to +14
'red',
'fuchsia',
'blue',
'aqua',
'lime',
'yellow',
'red',
Copy link
Member Author

Choose a reason for hiding this comment

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

I went with color names based on the existing code appearing to prefer names > short hex > long hex literals.
I also excluded the percentages because they aren't required (stops are spaced evenly if omitted) and more difficult to write clearly since stops are 1/6 instead of 1/10.

I can change either of these (names → short or long hex literals; add percentages) if it would be preferred.

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.

None yet

1 participant