Skip to main content

I’m trying to convert Figma’s color to RGB but the values doesn’t match.

Here is the example:

On Figma I have RGB 23,23,23 that is an HEX 171717

But from API I got those values:


r: 0.10196078568696976

g: 0.10196078568696976

b: 0.10196078568696976

a: 1


Using Math to solve this, I got an RBG of 26,26,26.

Does anyone know the algorithm to get the 23,23,23?


Thanks.

Figma Color


API Result


Math Math.round(val * 255).toString(16);

Examples:


Math.round(1 * 255) = 255

.toString(16) = ff


Math.round(0.10196078568696976 * 255) = 26

.toString(16) = 1a

In this second example should be 23 and 17 instead of 26 and 1a as the image here.


I found the solution.

The problem was an remote element with the same name.

I checked the elements with remote = false and I was able to find the correct one.


Reply