Why us gui.set_color not giving me the right color? (SOLVED)

#1

Dear,

I’m using the script available here: https://defold.com/tutorials/hud/

my problem is this part of the code:
– initially transparent
gui.set_color(node, vmath.vector4(1, 1, 1, 0))
gui.set_outline(node, vmath.vector4(0, 0, 0, 0))
– fade in
gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_OUT, 0.3)
gui.animate(node, gui.PROP_OUTLINE, vmath.vector4(0, 0, 0, 1), gui.EASING_OUT, 0.3)

it works with white rgba (1,1,1,1) but if i switch it to orange to fit my game design: rgba(216, 135, 14, 1). I got blue. I tried other color (green), I got purple.

So is it RGBA? am I using the right command?.. what am I doing wrong?

Thanks a lot

Regards
Riad Okba

0 Likes

#2

Hi there,

Colors range from [0, 1].
Your rgba(216, 135, 14, 1) should look like this instead: rgba(216 / 255, 135 / 255, 14 / 255, 1)

5 Likes

#3

Thanks a million Klayton

I understand what I was doing wrong now :slight_smile:

Regards
Riad

2 Likes