Frontmatter
| id | 5094 |
| title | Design Token conversion script should consider color modifications |
| state | Closed |
| labels | enhancementstale |
| assignees | [] |
| createdAt | Nov 13, 2023, 6:32 PM |
| updatedAt | Sep 12, 2024, 4:29 AM |
| githubUrl | https://github.com/neomjs/neo/issues/5094 |
| author | mxmrtns |
| commentsCount | 4 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Sep 12, 2024, 4:29 AM |
Design Token conversion script should consider color modifications

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:
i am not sure how to best thread different space keys with SCSS

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
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