undefined Posted August 3, 2014 Posted August 3, 2014 I have a question. How to get hex color code with r-g-b? Thnx
50p Posted August 4, 2014 Posted August 4, 2014 If you want hex as string: function RGBtoHEX( r,g,b ) return string.format( "0x%x", tocolor( r,g,b ) ); end If you want hex as number: tocolor( r, g, b );
cheez3d Posted August 4, 2014 Posted August 4, 2014 Or if you want to convert from 3 or 4 numbers without tocolor: local ConvertRGBToHex = function(r,g,b,a) if a then return ("%02x%02x%02x%02x"):format(r,g,b,a); end; return ("%02x%02x%02x"):format(r,g,b); end;
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