Page 1 of 1

Problems with popcolor values

Posted: Tue Dec 03, 2019 6:19 pm
by rav81
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.

Re: Problems with popcolor values

Posted: Tue Dec 03, 2019 6:57 pm
by plouf
untested but this should work

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

Re: Problems with popcolor values

Posted: Tue Dec 03, 2019 7:01 pm
by rav81
THANKS A LOT, it seems to work, you are a lifesaver!

Need to read up on formatstr then :)