-
-
Notifications
You must be signed in to change notification settings - Fork 209
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add hsla helper using Color model #24
Conversation
Current coverage is 100% (diff: 100%)@@ master #24 diff @@
===================================
Files 5 7 +2
Lines 9 16 +7
Methods 0 0
Messages 0 0
Branches 0 0
===================================
+ Hits 9 16 +7
Misses 0 0
Partials 0 0
|
@guzart Thank you for taking the time to start this an opening the discussion. Even though chroma is fairly light weight, I'd be curious how much of the library will go unused by us. @mxstbr what are your thoughts on an external dependency here? Also 2 other things @guzart: if you can amend these commits to chores. We are running |
I'm not a fan of returning a chroma object here, as that's unnecessary API surface area. I don't want to add all of color manipulation, just sass-like What do you reckon @bhough? |
Agree @mxstbr that was my reasoning for the question about unused code from Chroma. Feels like it has way more than we need, and while convenient to have it available, most of that API would not get used in most cases. |
So color would be a better library to use/wrap? I like how color splits the getter between |
@guzart possibly, it is definitely closer. Though I would be worried slightly about wrapping it at this stage given that they are doing a pretty thorough rework of the library it seems from reading through the repo. |
Do you think having a Color class as the proxy between conversions is the way to go? const color = rgb('#1e90ff') // Color()
color.hsla() // { h: 210, s: 1, l: 0.56 } I also found this libraries:
|
Honestly, I'm not sure that is the way I would go. It would force every color to be stored as a I'm certainly open to any counter points on this though. |
I agree with @bhough, I don't see any value in providing |
Me neither, I also agree that it would be clunky. I was just copying what Sass does without thinking about the styled-components context 馃憥 . On a different note, I imagine the css`
border-color: ${hsla({ h: 210, s: 1, l: 0.56, a: 0.84 })}; // color: rgba(30, 144, 255, 0.84);
color: ${hsla(210, 1, 0.56, 0.84)}; // color: rgba(30, 144, 255, 0.84);
` |
That sounds useful to me! More explicitness yay! |
Yes, this would be great. Anywhere that we can support both styles-as-objects and traditional css properties via strings will be a win. Helps us work with as many approaches as possible. |
Just checked this out, |
PR does not match the desire API, conversation regarding API in #44 |
My goal was to expose a Polished API while using chroma-js behind the scenes, which is why the
Models.Color
works as a wrapper forchroma.Color
This might be completely off from the goals of the project, but I hope at least helps to get the conversation stated.
All types of criticism are welcome 馃槃 .
NOTE: Got 100% test coverage with
jest --watch
but not withjest --coverage
, am guessing something to do with babel transpiling?NOTE: Tried following JSDoc ES2015 class example, but the docs didn't pick the class until I used the
@constructor
tag, and theColor.hsla
method wasn't picked up