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:
Bind a click event to the input range to call color.showPicker().
input range is responsible for changing the alpha, and then color-mix() mixes the color and alpha to get the new color.
The color format obtained through getComputedStyle is color(), need to be converted to rgba() by convertColorToRGBA(), because resvg-js doesn't support color().
Use anchor positioning to make the color picker's popover follow the slider thumb.
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:
input range
to callcolor.showPicker()
.input range
is responsible for changing the alpha, and thencolor-mix()
mixes the color and alpha to get the new color.getComputedStyle
iscolor()
, need to be converted torgba()
byconvertColorToRGBA()
, becauseresvg-js
doesn't supportcolor()
.Closes: https://github.com/yisibl/resvg-js/issues/336
https://github.com/yisibl/resvg-js/assets/2784308/5d107eef-29c5-4ef8-986d-4055c19843aa