This package is abandoned and no longer maintained. The author suggests using the tylercd100/laravel-validator-color package instead.

Validate that a certain value is a valid CSS color string in Laravel 5

3.0.2 2017-04-20 17:26 UTC

This package is auto-updated.

Last update: 2020-10-28 16:12:59 UTC


Latest Version Software License Build Status Scrutinizer Code Quality Code Coverage Dependency Status Total Downloads

This package will let you validate that a certain value is a valid CSS color string.


Install via composer - In the terminal:

composer require tylercd100/laravel-validator-color

Now add the following to the providers array in your config/app.php



// Test any color type
Validator::make(['test' => '#454ACF'], ['test' => 'color']);

// Test for rgb 
Validator::make(['test' => 'rgb(0, 200, 150)'], ['test' => 'color_rgb']);

// Test for rgba 
Validator::make(['test' => 'rgba(0, 200, 150, 0.52)'], ['test' => 'color_rgba']);

// Test for hex 
Validator::make(['test' => '#333'], ['test' => 'color_hex']);

// Test for css color keyword 
Validator::make(['test' => 'gold'], ['test' => 'color_keyword']);