Here is how you can break apart a hex color string into the individual RGB values
Graphics 640,480
hex_value=$ffaabbcc
Print Hex((hex_value And $FF0000) Shr 16)
Print Hex((hex_value And $FF00) Shr 8)
Print Hex(hex_value And $FF)
MouseWait()
End
In the above example, the first $ff is the alpha value. Then are listed the RGB values, $aa, $bb, $cc.
Since the Hex command converts numeric hex values into alphanumeric string values, in case you want to numerically alter the RGB values (something you cannot do to a string), then for actual usage, instead of Print..., do something like (leaving off the "Hex" command):
Graphics 640,480
hex_value=$ffaabbcc
my_red = ((hex_value And $FF0000) Shr 16)
my_green = ((hex_value And $FF00) Shr 8)
my_blue = (hex_value And $FF)
MouseWait()
End
|