03-12-2013, 06:02 AM
For dealing with many HTML colors.
Function ColorFromHTML
Macro Use ColorFromHTML
Function ColorFromHTML
;/
function# $RRGGBB
;Returns color value in format BBGGRR
;0xa75c4 -> C4750A
if empty(RRGGBB)
,ret 0xFFFFFF
if findrx(RRGGBB "^(0x|0X)?[0-9A-Fa-f]+$" 0 0 _s 1)<0
,end "error: 'RRGGBB' notation"
if empty(_s)
,_s.from("0x" RRGGBB)
else _s=RRGGBB
_i=val(_s)
ret (_i&0xFF<<16) | (_i&0xFF00) | (_i&0xFF0000>>16)
Macro Use ColorFromHTML