Get RGB from a colour name

I'm sure this must be part of the colors and crayons lib but I can't see the wood for the trees!

I'm just wanting to translate simple colour names (red,,cyan,magenta,yellow,pink,purple,orange,black and white) into their RGB values

untitled script pic (40)
Just use that! Should work fine.

EDIT: Use that after setting the pen to a crayon with something like untitled script pic (39)
I suggested using a crayon because you said translating color names.

You could create a lookup table, then just use the asoc block to find the rbg value. For example,


For the table, then to get the color value, you just use the asoc block in the list utilities library like this to get the color from the name.

I was hoping that something in the lib world do that for me

Ok, I checked the library, and there is a block for that. The color from block. Just set the first input to crayon, then you can type in any color into the next input (even the category colors, not custom ones though). You can also click the dropdown to get a list of all the color names. Then to convert the result to an rgba list, just stick the block into the [] from color block with the first input being rgba vector.

In case you do not understand any of that, here's some screenshots


And yes, each color name has a corresponding number, so you aren't limited to using the color names.

Crayon numbers have to be integers, so there aren't any unnamed ones. If you want to interpolate, use COLOR NUMBER instead of CRAYON. :~)

Oh, ok, although you can use a crayon number instead of a name in the input.

Thank you for working it out :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.