Hex Colour From Colour Selector Object
Hi All,
I'm making a HTML editor but can't figure out how to get the colour from the Colour Selector object in to a Hex colour. The object doesn't seem to support giving you the RRGGBB values to use Hex$ in MMF2?
Any help would be greatly appreciated!
Thanks,
Steve
Re: Hex Colour From Colour Selector Object
Hex$(Red + (Green * 256) + ( Blue * 65536))
Re: Hex Colour From Colour Selector Object
How do I grab the reds, greens and blues?
Re: Hex Colour From Colour Selector Object
I thought that the number the selector returned would already be Red + (Green * 256) + ( Blue * 65536)
Re: Hex Colour From Colour Selector Object
If I get the colour from the object for pure red for instance all I get is 255. How do I know what the Green and Blue should be? Pure green gives you 65280 but again how do I know that the red and blue should be zero?
Re: Hex Colour From Colour Selector Object
GetRed(), GetGreen() and GetBlue().
Re: Hex Colour From Colour Selector Object
Thanks guys i'm getting there!
If I select pure red and convert that using Hex$(Red + (Green * 256) + ( Blue * 65536)) all I get back is FF?
Sorry for being such a pain!
Steve
Re: Hex Colour From Colour Selector Object
Hex$(colour) (no need for the red/green/blue functions) should get back the hex without 0s at the beginning. You need to use: left$("000000",6-len("hex"))+"hex" to add the right number of 0s to the beginning.
Re: Hex Colour From Colour Selector Object
That doesn't work though. MMF goes like [Blue * 65536 + Green * 256 + Red].
In other words, it would output the colours in the order Blue, Green, Red. On a website, you write them in the order Red, Green, Blue, the calculation will have to be [Red * 65536 + Green * 256 + Blue].
Re: Hex Colour From Colour Selector Object
Well then I guess you do need to do:
Hex$(GetRed(colour)*65536+GetGreen(colour)*256+Get Blue(colour))
And then:
left$("000000",6-len("hex"))+"hex"
to add the 0s to the beginning.