lukasoppermann / design-tokens

🎨 Figma plugin to export design tokens to json in an amazon style dictionary compatible format.
https://www.figma.com/community/plugin/888356646278934516/Design-Tokens
MIT License
964 stars 134 forks source link

Wrong HEX value is exported #174

Closed lavr001 closed 2 years ago

lavr001 commented 2 years ago

Hi,

I have 2 questions:

  1. When I exported a design tokens file from Figma, one color was exported with the wrong hex value (in Figma it was #010205, but after I run it through a style dictionary transformer it was #ff0205 in _variables.scss)
  2. All colors in design-tokens.colors.json file have an extra ff in the end of each hex value (e.g. the color above was #ff0205ff), that ff was removed from each color after I run the json file through a style dictionary, but just wondering why it's happening.

Thank you, Roman

lukasoppermann commented 2 years ago

Hey, the FF is transparency. Those are hex8 values. You need to do some custom transformer to convert it. It was already discussed in another ticket, let me find the link.

lukasoppermann commented 2 years ago

Hope that helps: https://github.com/lukasoppermann/design-tokens/issues/151

lavr001 commented 2 years ago

@lukasoppermann Thank you. Do you know what might be the reason for exporting one wrong hex value?

lukasoppermann commented 2 years ago

It's not wrong it's by design. Hex8 includes transparency. The last two characters are a transparency value. Hex8 is the preferred color value in the w3c design token spec

lavr001 commented 2 years ago

@lukasoppermann I'm referring to my first question. In Figma file one of the colors I'm exporting is #010205 (black) and in design-tokens.colors.json that color got a wrong hex value of #ff0205 (red). This is the only color that got a wrong value during the export.

Any ideas why it's happening?

lavr001 commented 2 years ago

Adding these 2 screenshots to clarify the issue:

figma_black design_tokens_black

.

lukasoppermann commented 2 years ago

Sorry, I missed that. Fix is out, please let me know if this solves the issue. Thank you.