phpcolor / tailwind-colors
Tailwind Colors - PHP Color Palette
v1.0.0
2026-08-22 08:02 UTC
Requires
- php: >=8.3
Suggests
- phpcolor/phpcolor: Provides ColorPaletteInterface objects through palette().
README
This package provides access to the color palettes used in Tailwind interfaces.
Installation
composer require phpcolor/tailwind-colors:^1.0
The package works standalone. Install phpcolor/phpcolor only when using palette():
composer require phpcolor/phpcolor
Usage
Color names
use PhpColor\Colors\Tailwind\TailwindColors as Tailwind; $colors = Tailwind::colors(); $names = $colors->getNames(); // 'slate', 'gray', 'zinc', 'neutral', 'stone', 'red', 'orange', // 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', // 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose'
Color shades
use PhpColor\Colors\Tailwind\TailwindColors as Tailwind; $colors = Tailwind::colors(); $shades = $colors->getShades(); // 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950
Color values
use PhpColor\Colors\Tailwind\TailwindColors as Tailwind; $colors = Tailwind::colors(); echo $colors->teal; // #14B8A6 echo $colors->teal(); // #14B8A6 echo $colors->teal(500); // #14B8A6 echo $colors->get('teal'); // #14B8A6 echo $colors->get('teal', 500); // #14B8A6
PHPColor palette
use PhpColor\Color\Palette\ColorPaletteInterface; use PhpColor\Colors\Tailwind\TailwindColors as Tailwind; $palette = Tailwind::colors()->palette('teal'); assert($palette instanceof ColorPaletteInterface); echo $palette->get(500)->toHex(); // #14b8a6
Calling palette() without phpcolor/phpcolor installed throws a LogicException with the installation command.
Credits
The colors listed in this project are based on the colors used by TailwindCss.
License
This PHPColor package is released under the MIT license.