How to output hex and rgb values for color tokens #1499
Unanswered
nareshbhatia
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have color tokens in the following format, some have hex values and others have rgba values:
{ "Color": { "Slate": { "100": { "$type": "color", "$value": "#111113" }, "200": { "$type": "color", "$value": "rgba(0, 0, 0, 0.0000)" } }, "Neutral": { "100": { "$type": "color", "$value": "{Color.Slate.100}" }, "200": { "$type": "color", "$value": "{Color.Slate.200}" } }, "Background": { "100": { "$type": "color", "$value": "{Color.Neutral.100}" }, "200": { "$type": "color", "$value": "{Color.Neutral.200}" } } } }I am trying to generate CSS output where:
Based on these requirements, here's the output I expect (note 2 values for all 100's & only 1 value for all 200's):
However this is what I am actually getting:
What is the easiest strategy to achieve this?
Here's my attempt so far (see github repo):
I added two transforms that filter tokens of type color and value in hex:
-rgbto the token namerr, gg, bbHere's how I add the two transforms to my
cssplatform, using thetransformsproperty:Issues:
csstransformGroup. Only the rgb values are output now. How can I output both values?slate-100and not toneutral-100andbackground-100β probably because the last two have alias values and those obviously don't match the hex color regex.Is there a good way to structure this code to solve both the issues?
Beta Was this translation helpful? Give feedback.
All reactions