Plugin to easily set colors

I made this plugin awhile ago, and it’s now free on the Solar2D directory. Hope you guys enjoy it.

Here’s some examples

-- setup
local materialColors = require "plugin.materialcolors"
materialColors.initHooks()

-- Hex
local circle = display.newCircle( 100, 100, 50 )
circle:setFillColor( "#FF0000" )
circle.stroke = 5
circle:setStrokeColor( "#00FF00" )

-- Hex with alpha
local circle = display.newCircle( 100, 100, 50 )
circle:setFillColor( "#FF00007F" ) -- about 50% alpha because of the 7F appended at the end
circle.stroke = 5
circle:setStrokeColor( "#00FF0000" ) -- 0% alpha because of the 00 appended at the end

-- Material Color
local circle = display.newCircle( 100, 100, 50 )
circle:setFillColor( "red350" )
circle.stroke = 5
circle:setStrokeColor( "green500" )

-- Material Color with alpha
local circle = display.newCircle( 100, 100, 50 )
circle:setFillColor( "red350-50" ) -- 50% alpha because of the -50 appended at the end
circle.stroke = 5
circle:setStrokeColor( "green500-0" ) -- 0% alpha because of the -0 appended at the end

Include it in your project now like this

{
    plugins = {
        ["plugin.materialcolors"] = {
            publisherId = "io.joehinkle",
        },
    },
}

GitHub repo: https://github.com/solar2d/io.joehinkle-plugin.materialcolors/

Enjoy!

5 Likes

Awesome Color Palettes
If you’re a designer or developer, you may have use for this plugin in order display colors to current or potential clients.
This plugin lets you easily show different color palettes with a shortcode.
The palettes are quiet nice, enlarging when you mouse over them and also revealing their hex codes.

This plugin lets you easily show different color palettes with a shortcode.. .