tokens-studio / figma-plugin

Official repository of the plugin 'Tokens Studio for Figma' (Figma Tokens)
https://www.figma.com/community/plugin/843461159747178978
MIT License
1.32k stars 190 forks source link

Ability to Choose Decimal Rounding Option for in the Plugin #2874

Open keeganedwin opened 2 weeks ago

keeganedwin commented 2 weeks ago

Is your feature request related to a problem? Please describe. Change the way or have an option in the plugin to not always round 4 digit decimals down to 3 digits? (SD also has the same output).

Use case: image (35)

Important Information: here’s the link describing how the plugin rounds decimals. It’s something we can change but [@six7](https://tokens studio.slack.com/team/U02DEJT4F1Q) will have to comment on this.

The Number.parseFloat(evaluated.toFixed(3)) part is executed. evaluated.toFixed(3) converts evaluated to a string containing a number with exactly three decimal places. Number.parseFloat(...) converts this string back to a number (float). Example: If evaluated = 100.123456 and the unit is false (e.g. null or undefined), then the return value will be 100.123

Describe the solution you'd like As per @six7 reply - We could add this as a QOL improvement as one of the followup releases.

From user - It should ideally be a configurable value

onurorhon commented 4 days ago

@keeganedwin here is the related SD-transform ticket, if you want to add to the description: https://github.com/tokens-studio/sd-transforms/issues/289