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

feat: rewrite color picker and add alpha picker #337

Merged
merged 1 commit into from
May 28, 2024
Merged

Conversation

yisibl
Copy link
Owner

@yisibl yisibl commented May 27, 2024

We've combined input range and input color into one to keep it aesthetically pleasing and harmonious on the UI.

Here are a few tips:

  1. Bind a click event to the input range to call color.showPicker().
  2. input range is responsible for changing the alpha, and then color-mix() mixes the color and alpha to get the new color.
  3. The color format obtained through getComputedStyle is color(), need to be converted to rgba() by convertColorToRGBA(), because resvg-js doesn't support color().
  4. Use anchor positioning to make the color picker's popover follow the slider thumb.

Currently only Chrome is supported.

Closes: #336

2024-05-28.00-30-21.mp4

Copy link

vercel bot commented May 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
resvg-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2024 3:44pm

@yisibl yisibl merged commit bff2e89 into main May 28, 2024
37 checks passed
@yisibl yisibl deleted the add-alpha-picker branch May 28, 2024 16:10
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.

Playground background value support alpha
1 participant