Problems with popcolor values

Discuss GUI programming with the RapaGUI plugin here
Post Reply
rav81
Posts: 2
Joined: Tue Dec 03, 2019 8:48 am

Problems with popcolor values

Post by rav81 » Tue Dec 03, 2019 6:19 pm

Hi everyone.

So I use the popcolor and try to fetch the value with

Code: Select all

color_header=HexStr(moai.Get("color_header", "RGB")) 
Works fine unless any of the R/G/B is 0, then the length of the hex changes.

Examples:
R/G/B:
0/0/0 = $0
255/255/255 = $FFFFFF
0/255/255 = $FFFF
0/255/0 = $FF00

Am I doing this wrong?
How can I ensure that I always get the 6 digit hex (2x3 digits)?
Is there a away to get the seperate R,G and B values?

Thanks.

plouf
Posts: 72
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Problems with popcolor values

Post by plouf » Tue Dec 03, 2019 6:57 pm

untested but this should work

color_header=FormatStr("$%.6x",moai.Get("color_header", "RGB"))

rav81
Posts: 2
Joined: Tue Dec 03, 2019 8:48 am

Re: Problems with popcolor values

Post by rav81 » Tue Dec 03, 2019 7:01 pm

THANKS A LOT, it seems to work, you are a lifesaver!

Need to read up on formatstr then :)

Post Reply