Open jescalan opened 9 years ago
We wrote a pretty good color parser/library back in the day that might make this easier for you: https://github.com/One-com/one-color
This looks fantastic @Munter -- thank you! Definitely will take advantage of this :grinning:
How do you propose that we pass a color into accord, if not as a stylus color node?
I'd propose taking accepting valid css color declaration (hex, rgba, etc), then having accord do the conversion in the background to a stylus color node.
Passed as a string? Or as some type of special object?
— Sent from Mailbox
On Thu, Dec 18, 2014 at 3:46 PM, Jeff Escalante notifications@github.com wrote:
I'd propose taking accepting valid css color declaration (hex, rgba, etc), then having accord do the conversion in the background to a stylus color node.
Reply to this email directly or view it on GitHub: https://github.com/jenius/accord/issues/59#issuecomment-67553927
String
Then how would we pass a string that's in the same format as a color without it being turned into a color object? Or a string that may or may not be in the same format as a color?
We would assume that if you are passing a css color, you want it to be a color, not a string. I feel like this is a very fair assumption that will comprise 99.9% of cases, so I'm comfortable with affording most people lots of extra convenience at the cost of maybe one crazy edge case. I'd rather make a workaround for people that do not want this behavior than the other way around. And I'm honestly ok with not making one at all until we receive a complaint, which I highly doubt we will.
I recently used this library which did all the coercion for me. https://github.com/pressly/stylus-coerce Maybe this info helps.
Right now if you want to pass a color into stylus, it needs to pull stylus' class and initialize a custom object with an rgba array. This is an unintuitive pain in the ass. Luckily, we can definitely fix this and make stylus take any normal css color, then just convert it to the stylus format before passing to the adapter. This would probably be a useful addition for a lot of people :grinning: