Created
September 17, 2019 17:31
-
-
Save mattkrins/0732f603d7baa2a01963665d3ac4f07c to your computer and use it in GitHub Desktop.
Garry's Mod (gmod) Hex to RGB color helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function HexColor(hex, alpha) | |
hex = hex:gsub("#","") | |
return Color ( tonumber("0x" .. hex:sub(1,2)), tonumber("0x" .. hex:sub(3,4)), tonumber("0x" .. hex:sub(5,6)), alpha or 255 ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tests:
Results:
Based on https://gist.github.com/jasonbradley/4357406