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
951 stars 130 forks source link

Better support for radial gradient #202

Open Yoksy opened 2 years ago

Yoksy commented 2 years ago

Hello Lukas, thank you for this amazing plugin, its helping greatly my team settings up design tokens from figma to our apps!

I have noticed that the position parameter is missing when exporting radial gradient.

Example : radial-gradient(100% 100% at 50% red 0, green 100%) where 100% 100% at 50% is the position param.

Current export look like this:

"primary-radial": {
  "description": "",
  "type": "custom-gradient",
  "value": {
    "gradientType": "radial",
    "rotation": 87.7787395349543,
    "stops": [
        {
            "position": 0,
            "color": "red"
        },
        {
            "position": 1,
            "color": "green"
        }
    ]
},

And the exported CSS variable look like this : radial-gradient(red 0%, green 100%)

Could you look into it ? Thanks.

nmereus-turner commented 2 years ago

I have a similar issue with linear gradients not exporting the variables properly.

Export: "50% overlay": { "description": "", "type": "custom-gradient", "value": { "gradientType": "linear", "rotation": 360, "stops": [ { "position": 0, "color": "#000000cc" }, { "position": 0.53, "color": "#00000000" } ] },

Is exporting this as variable: $gradient-gradient-50-overlay: [object Object];

lukasoppermann commented 2 years ago

Hmm, this does seem wrong.

So the position you get is basically 0% and 100%. Can you please attach a picture of how the gradient looks in figma?

Yoksy commented 2 years ago

So the position you get is basically 0% and 100%.

Yes

Can you please attach a picture of how the gradient looks in figma?

figma-bug-radial-1 figma-bug-radial-2