Let users pick a color from a fixed list of options.

Overview

Let users pick a color from a fixed list of options.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This packages implements a new ColorPalette field as described in the mini-series on my blog.

It gives users a fixed set of color options to choose from and the option to choose an arbitrary custom color.

Installation

You can install the package via Composer:

composer require ryangjchandler/filament-color-palette

Usage

Add the field to your form like so:

use RyanChandler\FilamentColorPalette\ColorPalette;

ColorPalette::make('color')
    ->options([
        '#ffffff' => 'White',
        '#ff0000' => 'Red',
        '#000000' => 'Black',
    ]),

Store color name instead of code

You may wish to store the name (label) of a color instead of the color code. This can be achieved by calling the storeColorName() method on the field.

ColorPalette::make('color')
    ->storeColorName()
    ->options([
        '#ffffff' => 'White',
        '#ff0000' => 'Red',
        '#000000' => 'Black',
    ]),

Now instead of the hex codes being stored, the name from the options array will be used instead.

Custom colors

If you want your users to have some more freedom, you can allow them to choose custom colors. Call the ->allowCustomColors() method on the field and a custom color picker will appear in the options.

ColorPalette::make('color')
    ->allowCustomColors()
    ->options([
        '#ffffff' => 'White',
        '#ff0000' => 'Red',
        '#000000' => 'Black',
    ]),

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

You might also like...
A Laravel package providing a list of the countries, states, cities, currencies and timezones
A Laravel package providing a list of the countries, states, cities, currencies and timezones

A Laravel package to provide a list of the countries, cities, timezones, currencies and phone numbers formatting/validation helpers. The package can b

The list of all Algerian provinces and cities according to the official division in different formats: csv, xlsx, php, json, etc.

algeria-cities This repository contains the list of all the administrative provinces and cities in Algeria. The data is up-to-date according to the of

Ani Cast - Anime List & Trending App. (Powered by Jikan API)

(Under Development) Ani Cast - Anime Shows App.

A simple laravel state machine to handle model transitions, based on a pre-defined list of rules
A simple laravel state machine to handle model transitions, based on a pre-defined list of rules

A simple state machine that allows transitioning model states based on pre-defined rules. Installation You can install the package via composer: compo

This Laravel package merges staudenmeir/eloquent-param-limit-fix and staudenmeir/laravel-adjacency-list to allow them being used in the same model.

This Laravel package merges staudenmeir/eloquent-param-limit-fix and staudenmeir/laravel-adjacency-list to allow them being used in the same model.

Merge of staudenmeir/eloquent-eager-limit and staudenmeir/laravel-adjacency-list

This Laravel package merges staudenmeir/eloquent-eager-limit and staudenmeir/laravel-adjacency-list to allow them being used in the same model.

Create a downloads list - quick and easy. With categories and mobile friendly design
Create a downloads list - quick and easy. With categories and mobile friendly design

Simple downloads list plugin for wordpress Create a downloads list - quick and easy. With categories and mobile friendly design What is Simple downloa

Laravel Impersonate is a plugin that allows you to authenticate as your users.

Laravel Impersonate Laravel Impersonate makes it easy to authenticate as your users. Add a simple trait to your user model and impersonate as one of y

Talk is a real-time users messaging and chatting system Laravel.
Talk is a real-time users messaging and chatting system Laravel.

Laravel-Talk Talk is a Laravel 5 based user conversation (inbox) system with realtime messaging. You can easily integrate this package with any Larave

Comments
Releases(v1.0.0)
Owner
Ryan Chandler
Ryan Chandler
Takes in a HEX color and produces variations of that colour for the foreground and background

css-colors Takes in a HEX color and produces variations of that colour for the foreground and background It takes a great php class made by Patrick Fi

Soapbox Innovations Inc. 9 Jul 24, 2020
Laravel Users | A Laravel Users CRUD Management Package

A Users Management Package that includes all necessary routes, views, models, and controllers for a user management dashboard and associated pages for managing Laravels built in user scaffolding. Built for Laravel 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6.0, 7.0 and 8.0.

Jeremy Kenedy 393 Nov 28, 2022
A simple Laravel package for generating download links with options such as expire time, IP restrictions, etc.

Generate download links in your Laravel applications This package allows you to generate download links for files. Once installed you can do stuff lik

Arman Ahmadi 12 Nov 24, 2022
A simple laravel package to validate console commands arguments and options.

Command Validator A simple laravel package to validate console commands arguments and options. Installation Require/Install the package using composer

Touhidur Rahman 20 Jan 20, 2022
Gallium is a TALL stack starter kit offering a robust set of options enabling you to get up and running in a snap.

Very short description of the package This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention o

null 1 Nov 20, 2021
Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily.

DevMakerLab/Laravel-Filters Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily. Insta

DevMakerLab 19 Feb 20, 2022
Let's base your Laravel project with PROS style

Purpose This library is for convenient methods that use to register code base for Laravel project Target We aimed to reduce complexity for real projec

Protean Studios Co., Ltd. 4 Mar 29, 2022
A plugin for Blessing Skin Server that can let you display Google Ads with Google AdSense in the website.

A plugin for Blessing Skin Server that can let you display Google Ads with Google AdSense in the website.

Big_Cake 2 Jan 25, 2022
Turn any Eloquent model into a list!

Listify Turn any Eloquent model into a list! Description Listify provides the capabilities for sorting and reordering a number of objects in a list. T

Travis Vignon 138 Nov 28, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023