You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there!
I'm setting up Theo for my project and know that it's possible to reference other token names, which is great! I was wondering if it's possible to apply math functions to tokens.
I currently have a general sizing Sass variable that we're hoping to extract into tokens:
$size-base-unit: 0.5rem; // = 8px
We then use that size unit for our typography sizing and spacing, like so:
You could write a transform that tests for the size function and performs the calculation. The only problem will be getting the value of $size-base-unit inside that transform function. We have a similar function that converts rems to px. I take advantage of the fact that theo merges global metadata into each prop, so instead of referencing another token, you could store that value in global metadaata.
Hi there!
I'm setting up Theo for my project and know that it's possible to reference other token names, which is great! I was wondering if it's possible to apply math functions to tokens.
I currently have a general sizing Sass variable that we're hoping to extract into tokens:
We then use that size unit for our typography sizing and spacing, like so:
The gist is that altering the base size unit will affect the typography and spacing systems, which is pretty neat.
Is it possible to do this type of thing at the token level? Or do those font size token values need hard coded?
Thanks very much!
The text was updated successfully, but these errors were encountered: