figma-plugin icon indicating copy to clipboard operation
figma-plugin copied to clipboard

Color Transforms

Open fokkerone opened this issue 1 year ago • 1 comments

Describe the bug If you add color modifier using PRO Token studio Version Color transform based on HSLA calucated/modified values are mostly wrong.

To Reproduce Steps to reproduce the behavior:

  1. Add a Color Modifier Token
  2. Choose darken, lighten
  3. Choose hsl in color model
  4. Calculated Values are complete wrong based on other color transformer/math or libraries.
  5. See error

Expected behavior Color Transforms on HLSA should be accurate and do not create falsy values see screenshot color value of hsla(100, 100& 50%, 1) darken by 20% should become hsla(100, 100& 40%, 1)

like here...simply math : Lighten color by 20% is 50%(light) * 0.8 = 40%

Screenshots or Screencasts Bildschirmfoto 2024-07-01 um 13 14 28

fokkerone avatar Jul 01 '24 11:07 fokkerone

It seems that the error is only in displaying the resulting hsl/lch value in the token properties window. Actual color is correct, save for minimal rounding error. For example, on this screenshot, when applying lighten 0.5 to #000, TS displays the result as lch(75 0 0), when the value is actually lch(50 0 0), or #777. The resulting hex is correct, both in the token tooltip and when applying the token to objects.

image image

sheila-semrush avatar Oct 10 '24 22:10 sheila-semrush

Hey @fokkerone, I see that you're a part of our slack community. Does this thread perhaps address the same issue as the ticket?

keeganedwin avatar Nov 24 '24 10:11 keeganedwin