Color in gui box node not displaying properly RGB colors

Hey,
im using BOX node to check the BUTTON status (pressed/released) and I found a bug related with a RGB color displaying for instance when I set the color to vmath.vector3(255, 128, 0) it will turn into purple (should be orange) or vmath.vector3(255, 255, 255) is black (should be white) and there is much more…

using this method:
gui.set_color(node, color)

1 Like

You should use vector4. Components are RGB and Alpha.

1 Like

vmath.vector4(255, 128, 0, 1) now its green
vmath.vector4(255, 255, 255, 1) still black

Oh, values are floats. 0.0 - 1.0.

1 Like

so you fond whats wrong?

Yes, max value is 1.0, not 255.

1 Like

is it intended to be like that? :smiley:

Using 0 to 1 is common notation for floating point colors. 0 to 255 is an old remain from the days when color was only 8-bit. Using floating point color makes for better future proofing. And it is easier to do math with aswell. Really it is better in every way except that people are pretty used to the old 255 range.

Brw. Shaders also use 0,1 color components.

2 Likes

I think you guys should change nodes Color property to floating point because its misleading to use the RGB.

UI elements are chosen based on convention. Pretty much every color picker uses 3x8 bit RGB values.

Hi! Quick question: if I get an online colour selector where (255,255,255) is pure white, do i just divide the three numbers by 255 to make it into a vmath.vector3()?

1 Like

Yes :wink: and as it is posted above vector4 to include also alpha

1 Like