djstarcom/nova-color-field
A color picker field for Laravel Nova. Adds a customizable color input to your Nova resources, letting you store and edit hex color values directly from the admin panel. Simple integration via a single field class in your resource definitions.
djstarcom/nova-color-field is a Laravel Nova form field for selecting and displaying colors. Start in a Laravel app that already has Nova installed:
composer require djstarcom/nova-color-field
$table->string('brand_color')->nullable();
Color field and add it to fields():use DJStarCOM\NovaColorField\Color;
public function fields(NovaRequest $request)
{
return [
Color::make('Brand Color', 'brand_color')
->rules('required', 'string', 'max:32')
->help('Choose the brand color used in the UI.'),
];
}
First use case: a nullable brand/accent color on a settings, team, or profile resource, edited through Nova and stored as a normal string column.
Where to look first: the package README and vendor/djstarcom/nova-color-field, then the Nova resource’s fields() method and the migration column. For the 3.0 upgrade, read the linked changelog before changing constraints.
rules, nullable, default, help, hideFromIndex, onlyOnForms, and readonly where appropriate.rgba()/rgb(), allow enough column length and validate that format.resolveUsing/fillUsing if you need a canonical stored value, such as lowercase six-digit hex.default('#ffffff') or a model-level default for new records, but still validate because defaults do not guarantee valid user input.composer.json constraints for PHP/Laravel/Nova compatibility, and test on staging before rolling to production.php artisan nova:publish, php artisan optimize:clear, and composer dump-autoload.rgba(...) values need more room.null for empty values and make the column nullable if that is intended.How can I help you explore Laravel packages today?