Jump to content

Hex Color


undefined

Recommended Posts

Posted

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 ); 

Posted

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; 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...