Getting RGBA values from a Variables Colorwell
-
This came up in a class today, and thanks to Just van Rossum, we were able to solve it.
We all love being able to pick from the colorwell variable, but sometimes you need to know the RGBA value of the picked color, but the color you get from a colorwell is a NSColor object.
This will give you the RGBA of that color
Variable([ dict(name="color", ui="ColorWell") ], globals()) color = color.colorUsingColorSpaceName_("NSCalibratedRGBColorSpace") r,g,b,a = color.redComponent(), color.greenComponent(), color.blueComponent(), color.alphaComponent() print(r,g,b,a)
(now in a year I'll be able to find the answer again!)
-
thanks for sharing!