undefined Posted August 3, 2014 Share Posted August 3, 2014 I have a question. How to get hex color code with r-g-b? Thnx Link to comment
50p Posted August 4, 2014 Share 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 ); Link to comment
cheez3d Posted August 4, 2014 Share 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; Link to comment
undefined Posted August 4, 2014 Author Share Posted August 4, 2014 Thank you Cheez3D and 50p. It's solved. Link to comment
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