-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Summary
When tokens are turned into CSS for light and dark color scheme, this is usually done with a media query and a lot of code duplication.
Luckily CSS has a light-dark() function, that can be used for that. In order to generate such code, you need access to both the light and dark value of a token at the same time.
My first question isn't about Terrazzo generating the code, but having the dataset to do so (directly or per plugin). Since DTCG spec is 1.0 it has support for modes but - as much as I understood it - a token never has access to multiple mode values at the same time (I'm happy to be wrong here)? Is there spec work needed or is the modes spec sufficient enough?
Proposal & prior art
I've done this as a plugin for style dictionary myself as part of Theemo and used a different way of storing these permutations of value on a token (I refer to them as constrained token/value):
- https://theemo.io/theming/build/css-custom-properties-light-dark
- https://gos.si/blog/theemo-v1-0-design-tokens-from-figma-into-css-with-property-light-dark-and-color-functions
If spec work is needed, which surely is lower-level than modes, I think I researched the prior art myself.
Also I know timing wise the industry is implementing the stable token spec at first. We had a lovely session about this, now I remembered to put it into an issue :)
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)