Color in gui box node not displaying properly RGB colors

#1

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

#2

You should use vector4. Components are RGB and Alpha.

1 Like

#3

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

0 Likes

#5

Oh, values are floats. 0.0 - 1.0.

1 Like

#6

so you fond whats wrong?

0 Likes

#7

Yes, max value is 1.0, not 255.

1 Like

#8

is it intended to be like that? :smiley:

0 Likes

#9

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

#10

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

0 Likes

#11

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

0 Likes

#12

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

#13

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

1 Like