phpcolor/material-colors

Material Design Colors - PHP Color Palette

Maintainers

Package info

github.com/phpcolor/material-colors

Homepage

pkg:composer/phpcolor/material-colors

Transparency log

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

v1.0.0 2026-08-22 08:02 UTC

This package is auto-updated.

Last update: 2026-08-22 09:16:34 UTC


README

This package provides access to the Material Design color palette, Google's design system colors.

Installation

composer require phpcolor/material-colors:^1.0

The package works standalone. Install phpcolor/phpcolor only when using palette():

composer require phpcolor/phpcolor

Usage

Create Colors Instance

use PhpColor\Colors\Material\MaterialColors as Material;

$colors = Material::colors();

Color Names

use PhpColor\Colors\Material\MaterialColors as Material;

$colors = Material::colors();

$names = $colors->getNames();
// 'red', 'pink', 'purple', 'deepPurple', 'indigo', 'blue',
// 'lightBlue', 'cyan', 'teal', 'green', 'lightGreen', 'lime',
// 'yellow', 'amber', 'orange', 'deepOrange', 'brown', 'gray', 'blueGray'

Color Shades

use PhpColor\Colors\Material\MaterialColors as Material;

$colors = Material::colors();

// Get shades for a color (50, 100-900, A100, A200, A400, A700)
$shades = $colors->getShades('red');
// [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 'A100', 'A200', 'A400', 'A700']

Color Values

use PhpColor\Colors\Material\MaterialColors as Material;

$colors = Material::colors();

// Default shade is 500
echo $colors->blue;                // #2196F3
echo $colors->blue();              // #2196F3

// Specify numeric shade (50, 100-900)
echo $colors->blue(700);           // #1976D2
echo $colors->get('red', 900);     // #B71C1C

// Specify accent shade (A100, A200, A400, A700)
echo $colors->red('A700');         // #D50000
echo $colors->get('blue', 'A200'); // #448AFF

PHPColor Palette

use PhpColor\Color\Palette\ColorPaletteInterface;
use PhpColor\Colors\Material\MaterialColors as Material;

$palette = Material::colors()->palette('red');
assert($palette instanceof ColorPaletteInterface);

echo $palette->get('A700')->toHex(); // #d50000

Calling palette() without phpcolor/phpcolor installed throws a LogicException with the installation command.

Credits

The colors listed in this project are based on Material Design.

License

This PHPColor package is released under the MIT license.