Jump to content

Converting HEX to R G B


MIKI785

Recommended Posts

Posted

Hello,

It's a little bit stupid question but how to convert HEX code (like #FF0000) To RGB format? (red- 250, 0, 0)

I didn't find answer and I don't think it's too difficult to answer..

thanks.

Posted
function hex2rgb(hex) 
  hex = hex:gsub("#","") 
  return tonumber("0x"..hex:sub(1,2)), tonumber("0x"..hex:sub(3,4)), tonumber("0x"..hex:sub(5,6)) 
end 

Code is not mine, Aiboforcen wrote it.

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...