materialYouColors.* — Material You Colors

Type Library
Revision Release 2022.3683
Keywords Material You Colors, Material UI
Platforms Android
Sample https://github.com/solar2d/com.solar2d-plugin.materialYouColors/tree/master/demo

Overview

The Material You Colors plugin get Material UI colors set in System Settings by the user.

Gotchas

This plugin is only supported on Android 12+ (Android API Level 31+) and only works with Solar2D 3672+

Syntax

local materialYouColors = require( "plugin.materialYouColors" )

Function

materialYouColors.getColors()

returns a 3d Array of all system colors: 1d contains 5 color groups accent colors 1,2,3 and neutral colors 1,2, 2d contains 13 different shades of the color with 1 being the lightest, and 13 being the darkest, and 3d contains red, greed, blue(in that order)

Sample

local myColors = materialYouColors.getColors()

local color = display.newRect( display.contentCenterX, display.contentCenterY, 50, 50 )
color:setFillColor(myColors[1][4][1], myColors[1][4][2], myColors[1][4][3])

Project Settings

To use this plugin, add an entry into the plugins table of build.settings. When added, the build server will integrate the plugin during the build phase.

settings =
{
    plugins =
    {
        ["plugin.materialYouColors"] =
        {
            publisherId = "com.solar2d"
        },
    },      
}

Support