Last active
August 29, 2015 14:12
-
-
Save MyNameIsKodos/008a9cf31b204ece34c7 to your computer and use it in GitHub Desktop.
RGB (0-31) to 15 bit (For use with Colorful Lamps)
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 rgbto15(r,g,b) return (b%32)+((g%32)*32)+((r%32)*1024) end | |
function rgbToHex(r,g,b) return string.format("0x%02X%02X%02X",r,g,b) end | |
function hexToRGB(a) a=tonumber(a) return math.floor(a/65536)%256,math.floor(a/256)%256,a%256 end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment