aw codes icon logo
Docs Hub

Search across every project.

Palette Switch project

A color picker field for Filament Forms that uses preset color palettes.

3.x Current

On this page

Installation

Compatibility

Filament version Package version
3.x 1.x
4.x 2.x
4.x & 5.x 3.x

Palette requires PHP 8.2 or later and filament/filament.

Install the package

Install Palette via Composer:

composer require awcodes/palette

Register the views with your theme

Palette ships Blade views with Tailwind classes, so your theme has to scan them or the components will render unstyled.

Important

If you have not set up a custom theme and are using Filament Panels, follow the Filament custom theme instructions first.

Once you have a custom theme, add Palette's views to your theme's CSS file — or your app's CSS file if you are using the standalone packages:

@source '../../../../vendor/awcodes/palette/resources/**/*.blade.php';

The path is relative to the CSS file it appears in. The four levels of ../ assume the default theme location at resources/css/filament/admin/theme.css; adjust it if your theme lives elsewhere.

Publish the config file

Palette works without publishing its config. Publish it only if you want to change a default:

php artisan vendor:publish --tag="palette-config"

The published file has a single option:

return [
    'store_as_key' => false,
];

Setting store_as_key to true makes every Palette field store just the color's key instead of the full color array. See Storing colors for what that changes.

Next

With the package installed and your theme scanning its views, add a component to a form — see Components.