-
Notifications
You must be signed in to change notification settings - Fork 29
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
Stylus: Coerce colors etc #59
Comments
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 😀 |
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? — On Thu, Dec 18, 2014 at 3:46 PM, Jeff Escalante [email protected]
|
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. |
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 😀
The text was updated successfully, but these errors were encountered: