PDA

View Full Version : covert rgb to hex?


Maheerali
02/10/2016, 02:24 AM
My title says every thing. How we can convert rgb to hex.Hex can be in string form.

Gotham
02/10/2016, 06:17 AM
Use colorpicker.com,or seatch googlr , Integers is used in strings

SickAttack
02/10/2016, 06:21 AM
http://forum.sa-mp.com/showthread.php?t=590770

RGBToHex(color,&red,&green,&blue);

AbyssMorgan
02/10/2016, 06:25 AM
http://forum.sa-mp.com/showthread.php?t=590770

RGBToHex(color,&red,&green,&blue);

This function does not meet expectations. It is used to extract individual values of Red, Green, Blue, [Alpha]
See Color Converter (http://8.ct8.pl/29)


If you want to use color to SendClientMessage:

//Functions:
GetColorRGBA(color); //Return {RGB}
GetColorRGB(color); //Return {RGB}
GetColorARGB(color); //Return {RGB}

//Example:
new text[128];
format(text,sizeof(text),"%s this color is FF6600",GetColorRGBA(0xFF6600FF);



If you need clean conversion:

new hex[12];
format(hex,sizeof(hex),"%06x",ShiftRGBAToRGB(0xFF6600FF)); //hex is "FF6600"
format(hex,sizeof(hex),"%08x",0xFF6600FF); //hex is "FF6600FF"



RGB Include:
http://forum.sa-mp.com/showthread.php?t=590770

Maheerali
02/10/2016, 07:27 AM
Thanks