LearnNewsExamplesServices
Frontmatter
id5094
titleDesign Token conversion script should consider color modifications
stateClosed
labels
enhancementstale
assignees[]
createdAtNov 13, 2023, 6:32 PM
updatedAtSep 12, 2024, 4:29 AM
githubUrlhttps://github.com/neomjs/neo/issues/5094
authormxmrtns
commentsCount4
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtSep 12, 2024, 4:29 AM

Design Token conversion script should consider color modifications

Closed v8.1.0 enhancementstale
mxmrtns
mxmrtns commented on Nov 13, 2023, 6:32 PM

As shown in the link below, the JSON export from Token Studio includes the color modifications made in Figma.

Currently. the script can't interpret this description correctly and outputs incorrect variables.

Feature request: The conversion script should be able to interpret the color modifications and output the corresponding SCSS variables.

https://github.com/neomjs/neo/blob/92ab05e27b02de30cc5630ce99dbc7a68fd4a61f/resources/design-tokens/json/core.json#L1

Relevant parameter are:

type: darken or lighten value: 0-1 space: hsl, srgb, p3, lch

mxmrtns added the enhancement label on Nov 13, 2023, 6:32 PM
tobiu referenced in commit 329121e - "#5094 WIP" on Nov 13, 2023, 7:28 PM
tobiu
tobiu Nov 13, 2023, 7:29 PM

pushed a WIP version.

are the real values always inside the "500" key? or can it be anywhere in therory?

first result:

Screenshot 2023-11-13 at 19 23 08

i am not sure how to best thread different space keys with SCSS

tobiu
tobiu Nov 13, 2023, 7:45 PM

@mxmrtns: here is a full list of what we can use with SCSS: https://sass-lang.com/documentation/modules/color/#darken

e.g. darken() is no longer recommended, but color.scale() is.

@use 'sass:color';

// #036 has lightness 20%, so when darken() subtracts 30% it just returns black. @debug darken(#036, 30%); // black

// scale() instead makes it 30% darker than it was originally. @debug color.scale(#036, $lightness: -30%); // #002447

tobiu referenced in commit b7afe85 - "#5094 WIP => no longer relying on putting the base value into a "500" property" on Nov 13, 2023, 11:27 PM
ThorstenRaab referenced in commit 6d3b103 - "v6.9.12 (#5099) on Nov 16, 2023, 2:34 PM