Converts your hex or RGB values into Corona/Defold-compatible format (numbers from 0 to 1)
-
Put convertcolor.lua into your project directory
-
Load it from your files (where it's necessary)
local color = require("convertcolor")
- Use it to convert from hex:
color.hex("#ff00ff")
color.hex("#ff00ff", 0.5) --alpha set to 50%
.. and to convert from regular rgb:
color.rgb(255, 0, 255)
color.rgba(255, 0, 255, 0.1) --alpha set to 10%
local myText = display.newText( "example from Corona Docs", 0, 0, native.systemFontBold, 12 )
myText:setFillColor( color.hex("#ff10ae") )
go.set("#label", "color", vmath.vector4(color.rgb(255, 16, 174, 1))