-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
API - Color: Implement hex parsing #102
Comments
This is a good place to start looking: https://github.com/bryphe/revery/blob/master/src/Core/Color.re |
Sounds like @kitten might help us out here! 💯 |
What do you think about factoring out There are https://opam.ocaml.org/packages/gg/ and https://opam.ocaml.org/packages/color/, and I've been considering to base some solution off of it for Brisk. Your implementation is as close as I'd imagine it myself. |
Would be open to it, if it'd be useful!
Cool. I didn't know about https://opam.ocaml.org/packages/color/ - that looks like exactly what we need for parsing / hex conversion. The only other thing we really have beyond that here is our list of colors contributed by @bgoscinski : https://github.com/bryphe/revery/blob/master/src/Core/Colors.re - is that something that would be useful for Brisk? |
Sure, why not. I wonder if they could be upstreamed into |
I'm not that experienced in dealing with Dune, so I'd be happy to leave this up to someone else if we'd like to go for https://github.com/anuragsoni/color :) |
I went ahead and added the @rauanmayemir - @jchavarri had an idea that is relevant to the sharing out of these sorts of APIs. He drafted a proposal here: revery-ui/reason-reactify#35 I think it's a really cool idea - having some set of basic primitives that could be used between projects. Wouldn't it be neat if you could create a custom component that could be used in both |
We have a small
Color
API to parse / work with colors - it's very bare-bones at the moment, though!One important feature we need for it is creating colors from hex-values. Some examples of cases we should be able to parse:
#FFF
(3 element, rgb)#FFFA
(4 element, rgba)#01010F
(6 element, rgb)#0101CC0F
(8 element, rgb)It'd be fine to use a library for this (I'm sure there is one existing), but the main thing is just that we can parse these hex colors and get the right output.
An API like
Color.hex("#FFF")
that returns aColor.t
would be perfect. We should have tests covering this case, as well.The text was updated successfully, but these errors were encountered: