COMMUNITY

How to convert #BA1111 to RGB


(feng) #1

How to convert #BA1111 to RGB and 2 to 8, 10 to 2, in as3 ,I will use toString(2), but in haxe, I don’t know。 please help me ,thanks.


(Aleksandr Kuzmenko) #2


See “intro” section of Readme


(feng) #3

thank you! this is my need. but, There’s a bit of that I didn’t understand.
type Int not have hex, why this

public function toHex(prefix = “#”)
return ‘$prefix${red.hex(2)}${green.hex(2)}${blue.hex(2)}’;
function get_red(): Int
return (this >> 16) & 0xFF;


(Rudy Ges) #4

It’s from StringTools (https://api.haxe.org/StringTools.html), using static extension (https://haxe.org/manual/lf-static-extension.html)