New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

socialdept/color-scales

Generate Tailwind-compatible color palettes from any input color
1,162
Install
composer require socialdept/color-scales
Latest Version:v0.1.3
PHP:^8.3
Laravel:12 · 13
License:MIT
Last Updated:Nov 7, 2026
Links: GitHub  ·  Packagist
Maintainer: socialdept

Color Scales Header

Generate Tailwind-compatible color palettes from any input color.



This package turns a single color into an 11-shade palette, from 50 to 950, in the shape Tailwind CSS uses. It works out where the input color belongs in the scale, builds the other shades around it in HSLuv or HSL following the tints.dev algorithm, and exports the result as hex, RGB, HSL, OKLCH or a Tailwind v3 or v4 config. To learn all about it, head over to the documentation.

Here are a few short examples of what you can do.

Generate a palette from a hex color:

use SocialDept\ColorScales\ColorScale;

$palette = ColorScale::generate('#d8b965');

$palette->toHex();
// [50 => '#fcf3e1', 100 => '#f9e6c0', 200 => '#f1ce71', 300 => '#d8b965', ...]

Start from RGB, HSL or OKLCH instead:

$palette = ColorScale::generate('oklch(0.48 0.29 275)');

Export it as a Tailwind v4 @theme block:

echo $palette->toTailwindV4Config('primary', 'hex');
// @theme {
//   --color-primary-50: #f3f2ff;
//   ...
// }

Switch to linear mode, or shift the hue across the scale:

use SocialDept\ColorScales\Generator\ColorScaleGenerator;

$generator = new ColorScaleGenerator();

$generator->generateLinear('#d8b965');
$generator->generate('#511ef3', ['h' => 5]);

Documentation

You'll find the documentation on https://socialde.pt/docs/color-scales.

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving it? Feel free to create an issue on GitHub.

Testing

vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see LICENSE for more information.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

660,512,042 9,702
laravel/framework

The Laravel Framework.

617,629,957 34,997
laravel/tinker

Powerful REPL for the Laravel framework.

524,145,802 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

442,489,569 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

418,503,470 4,663

Version History

Version Released PHP Laravel License
v0.1.3 ^8.3 ^12.0|^13.0 MIT
v0.1.2 ^8.3 ^12.0 MIT
v0.1.1 ^8.3 ^12.0 MIT
v0.1.0 ^8.3 ^12.0 MIT