-
Notifications
You must be signed in to change notification settings - Fork 566
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
How to alias RGB with custom Alpha? #479
Comments
Apologies for the delayed response. I'm trying to figure out a way to do this right now and can't get it to work. We are working on the next major release (3.0) that I believe should make this possible. Let me try to get something working and get back to you. |
Awesome. Thank you for looking into this. We needed this working right away, so my workaround is: {
"color": {
"base": {
"grey": {
"90": { "value": "#252525", "rgb": "37,37,37" }
}
}
}
} Not ideal, but works for now until a better solution comes along. Looking fwd to v3. You guys are doing really great work here. |
@MrX8503 note with the workaround you described you now have 2 attributes for each colour token: I had the same workaround and found it inconvenient when I had to update colour tokens, so I did this instead:
|
@henry-wr cool, thanks for the workaround. It's more to write, but less error prone. |
@henry-wr that is a very neat approach but will this work with transforms? My understanding is that aliasing applies after transforms in which case you won't be able to transform the composed rgba into any other color representation - is that right? |
In the next version of Style Dictionary, 3.0, we are adding the ability to have transitive transforms. This would get around the issue with transforms that @Haemp mentions. Here is an example that shows how to add transparency to colors two different ways. By splitting up the RGB or HSL channels and combining them into a single value, or by defining a custom transitive transform that modifies a color (adding transparency or brightening, darkening, etc.). To try a pre-release of 3.0 you can install it with:
|
Just checking in on this, does the example I provided for the upcoming version solve this? Let me know if there are other things I can do to help. |
This is solved as part of 3.0 (#636). Check out the example at https://github.com/amzn/style-dictionary/tree/main/examples/advanced/transitive-transforms |
Style Dictionary v2.10.2
I would like to do the following:
But I get the following
--color-font-secondary: rgba(NaN, NaN, NaN, 0.2);
. Am I missing something? Is there a better way to reference a color, but change the opacity?The text was updated successfully, but these errors were encountered: