materialYouColors.* — Material You Colors

Type Library
Revision Release 2025.3721
Keywords Material You Colors, Material UI
Platforms Android

Overview

This plugin enables you to access Material UI colors set in System Settings by the user.

Gotchas

This plugin is supported only on Android 12 and later (Android API Level 31 and later) using Solar2D 2022.3672 and later.

Syntax

local materialYouColors = require( "plugin.materialYouColors" )

Function

materialYouColors.getColors()

Returns a 3D array of all system Material UI colors, structured as follows:

  • 1st dimension: Represents 5 color groups — accent1, accent2, accent3, neutral1, and neutral2.
  • 2nd dimension: Contains 13 shades for each color group, where index 1 is the lightest and 13 is the darkest.
  • 3rd dimension: Holds the RGB components of each shade, in the order: red, green, blue.

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