timothyasp/nova-color-field

A Laravel Nova Color Picker field.

Installs: 220 158

Dependents: 4

Suggesters: 1

Security: 0

Stars: 53

Watchers: 2

Forks: 11

Open Issues: 4

Language:Vue

1.0.4 2020-10-26 16:36 UTC

This package is auto-updated.

Last update: 2020-10-26 16:36:59 UTC


README

Dead simple Laravel Nova Color field. Includes a color picker from the vue-color component.

Details Page

details page color input

Index

index color

Installation

You can install the package in to a Laravel app that uses Nova via composer:

composer require timothyasp/nova-color-field

Usage

In your resource class, add the following to your fields method:

use Timothyasp\Color\Color;

....

Color::make("Field");

This will add the color picker to your resource, using vue-color's "slider" component by default. If you'd like to leverage another vue-color component, you can do so by calling that component's name as a method after Color::make():

use Timothyasp\Color\Color;

....

Color::make('Field')->compact()
// or
Color::make('Field')->slider()

and so on. You can use any one of: chrome, compact, grayscale, material, photoshop, sketch, slider, swatches.

Palette support for adding custom colors to the pickers is also available:

Color::make('Field')->compact()->palette(['#beaf00', '#DEADAF', '#000']);

Credits

Built for QuizGriz - the #1 online trivia and quiz game site

License

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