kobalte
kobalte copied to clipboard
feat: color picker
closes #360
- A "color" is a nth-dimensional array. Common specs are
[r,g,b],[h,s,v]/[h,s,b], and[h,s,l]. An implementation difficulty is that saturation is defined differently between HSV and HSL. Most color pickers work in HSV. The workaround is as follows: TheRootcomponent will accept aformat, which is one ofrgborhsv(hsl may not be supported initially because usage is very low). Many components accept achannel. This channel is one ofhue|saturation|value|red|green|blue|alpha. Only channels defined by the format choice will be allowed (for instance, ifformatisrgb, you cannot usehue). You may then useColorPicker.Viewto display and allow editing the color in a different format, conversions will be handled automatically. - Colors are generally convertible, but not always. For instance, many monitors are capable of displaying color beyond those allowed in the rgb space of 256^3. We must not concern ourselves with this, because HTML forms exclusively accept colors in the format
#rrggbb, and supporting these colors requires a drastic amount of work. - Make note of the lack of alpha in the allowed value for the form. Alpha is a common enough feature that we must support it. The input element will never include alpha. By default, the
valuewill not include alpha.withAlphamust be manually enabled. In this case, the input will continue to not include alpha, but thevaluewill. The value will always be in the format#rrggbbor#rrggbbaa, regardless of theformatprop.
Checklist
- [x]
ColorPicker.Root - [x] Conversion Primitives
- Input paradigms
- [x]
ColorPicker.Area- An area is a 2D representation of a color space. In the case of chrome's area, the
yaxis is brightness, and thexaxis is saturation. - [ ]
ColorPicker.AreaBackground- Supporting all possible
xandychannels is not feasible. We can provide a default implementation forsaturationandvalue, and allow the user to provide a custom implementation. Throw if this implementation is not provided.
- Supporting all possible
- [ ]
ColorPicker.AreaThumb
- An area is a 2D representation of a color space. In the case of chrome's area, the
- [ ]
ColorPicker.Slider- A slider is a 1D representation of a color space. In the case of chrome's slider, the
xaxis is hue. Can we use Kobalte's Slider component? - [ ]
ColorPicker.ChannelSliderBackground - [ ]
ColorPicker.ChannelSliderThumb
- A slider is a 1D representation of a color space. In the case of chrome's slider, the
- [ ]
ColorPicker.TransparencyGrid - [ ]
ColorPicker.ChannelInput- Text input
- [x]
- [x]
ColorPicker.View - [ ] Reexport popover
- [ ] Docs
Deploy request for kobalte pending review.
Visit the deploys page to approve it
| Name | Link |
|---|---|
| Latest commit | 0a5a84bca4074552eafb09c4ae1f1754de5b2e23 |
Thanks for the interest and PR!
However I'll be closing this in favor of #508 and #510 which cover a bit more and have already been fully implemented.