Adele Posted February 17, 2015 Share Posted February 17, 2015 (edited) Hi. I want to convert web color to rgba. I have tried this code but it hasn't work correct. For example, web code of red is #FF0000. I want to convert it to RGBA being Binary. Thank you in advance. $dGreen = 0xFF0000 $dBlue = BitAND($dColor, 0xFF) $dGreen = BitAND(BitShift($dColor, 8), 0xFF) $dRed = BitAND(BitShift($dColor, 16), 0xFF) $dColorRGBA = StringToBinary($dRed & $dGreen & $dBlue) Edited February 17, 2015 by Adele Link to comment Share on other sites More sharing options...
Solution UEZ Posted February 17, 2015 Solution Share Posted February 17, 2015 (edited) I think you are mixing up the color formats! Afaik the web color is in format RGB and you need to convert it to ARGB format. Sometimes you can code the web color in format #09C which is the same as #0099CC.RGB to ARGB:$color_hex_rgb = 0x1188AA $Blue = BitAND($color_hex_rgb, 0xFF) $Green = BitAND(BitShift($color_hex_rgb, 8), 0xFF) $Red = BitAND(BitShift($color_hex_rgb, 16), 0xFF) $color_argb = 0xFF000000 + $Red * 0x10000 + $Green * 0x100 + $Blue MsgBox(0, "Test", Hex($color_argb, 8))Br,UEZ Edited February 17, 2015 by UEZ Adele 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Adele Posted February 17, 2015 Author Share Posted February 17, 2015 I'm sorry for my ignorance. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now