Search by

phpinnacle / palette

phpinnacle

Color palette utilities for Laravel Filament applications.

Package info

github.com/phpinnacle/palette

pkg:composer/phpinnacle/palette

Statistics

Installs: 171

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

1.1.1 2026-09-06 08:36 UTC

This package is auto-updated.

Last update: 2026-09-06 08:42:58 UTC


README

phpinnacle/palette provides color palette utilities for Laravel Filament applications.

Installation

composer require phpinnacle/palette

Usage

use PHPinnacle\Palette\Color;
use PHPinnacle\Palette\ColorFormat;
use PHPinnacle\Palette\ColorSource;
use PHPinnacle\Palette\Forms\ColorPicker;

$random = Color::random();
$palette = Color::shades('#2563eb');
$hex = Color::hex(Color::Blue);
$primary = Color::resolve('primary');
$styles = Color::styles(Color::Blue);

ColorPicker::make('color')
    ->enable(ColorSource::Tailwind, ColorSource::Filament)
    ->shades(min: 100, max: 900)
    ->wide()
    ->format(ColorFormat::Rgba);

Color::DEFAULT contains the standard Filament semantic color scheme, while Color::SCHEME contains its supported names.

Color::resolve() reads the current Filament color registry on every call. Unknown names fall back to the current primary color. Palette does not keep a separate cache, so resolution follows the active Filament registry when it changes.

ColorPicker uses only the custom color source and stores HEX by default. Add or remove sources with enable(ColorSource ...$sources) and disable(ColorSource ...$sources). shades(int $min = 50, int $max = 950) keeps the standard Tailwind shades within the inclusive boundaries.

The popover sizes itself to the selected Tailwind shade range. Call wide() to make it match the input width.

The storage format may be ColorFormat::Hex, ColorFormat::Rgba, or ColorFormat::Hsl. RGBA fields also expose opacity and preserve their alpha channel. ColorFormat::Semantic uses only the Filament source and stores its registered alias, such as primary, success, or danger, instead of converting it to a color value:

ColorPicker::make('color')
    ->format(ColorFormat::Semantic);

License

The MIT License (MIT). See License File.