1- # laravel-validator-color
1+ # Validate colors with Laravel 5
22[ ![ Latest Version] ( https://img.shields.io/github/release/zenapply/laravel-validator-color.svg?style=flat-square )] ( https://github.com/zenapply/laravel-validator-color/releases )
33[ ![ Software License] ( https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square )] ( LICENSE.md )
44[ ![ Build Status] ( https://travis-ci.org/zenapply/laravel-validator-color.svg?branch=master )] ( https://travis-ci.org/zenapply/laravel-validator-color )
77[ ![ Dependency Status] ( https://www.versioneye.com/user/projects/56f3252c35630e0029db0187/badge.svg?style=flat )] ( https://www.versioneye.com/user/projects/56f3252c35630e0029db0187 )
88[ ![ Total Downloads] ( https://img.shields.io/packagist/dt/zenapply/laravel-validator-color.svg?style=flat-square )] ( https://packagist.org/packages/zenapply/laravel-validator-color )
99
10+ This package will let you validate that a certain value is a valid CSS color string.
11+
1012## Installation
1113
1214Install via [ composer] ( https://getcomposer.org/ ) - In the terminal:
@@ -17,4 +19,22 @@ composer require zenapply/laravel-validator-color
1719Now add the following to the ` providers ` array in your ` config/app.php `
1820``` php
1921Zenapply\Validator\Providers\ColorValidatorServiceProvider::class
20- ```
22+ ```
23+
24+ ## Usage
25+
26+ ``` php
27+ // Test any color type
28+ Validator::make(['test' => '#454ACF'], ['test' => 'color']);
29+
30+ // Test for rgb
31+ Validator::make(['test' => 'rgb(0, 200, 150)'], ['test' => 'color_rgb']);
32+
33+ // Test for rgba
34+ Validator::make(['test' => 'rgba(0, 200, 150, 0.52)'], ['test' => 'color_rgba']);
35+
36+ // Test for hex
37+ Validator::make(['test' => '#333'], ['test' => 'color_hex']);
38+
39+ // Test for css color keyword
40+ Validator::make(['test' => 'gold'], ['test' => 'color_keyword']);
0 commit comments