2017 © Pedro Peláez
 

library php-color

PHP Color Utilities

image

hugsbrugs/php-color

PHP Color Utilities

  • Friday, March 17, 2017
  • by hugsbrugs
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

php-color

This library provides utilities function to ease color manipulation, (*1)

Build Status Coverage Status, (*2)

Install

Install package with composer, (*3)

composer require hugsbrugs/php-color

In your PHP code, load library, (*4)

require_once __DIR__ . '/../vendor/autoload.php';
use Hug\Color\Color as Color;

Test a color is hexadecimal, (*5)

Color:: is_hexa_color($color, $with_hash = true);

Examples, (*6)

var_dump(Color::is_hexa_color('#fff'));
(bool)true
var_dump(Color::is_hexa_color('#fff555'));
(bool)true
var_dump(Color::is_hexa_color('frfrfr', false));
(bool)false

Convert hexadecimal color to RGB, (*7)

Color:: hexa_to_rgb($hex, $return = 'array');

Examples, (*8)

var_dump(Color::hexa_to_rgb('#fff'));
array(3) {
  'R' => int(255)
  'G' => int(255)
  'B' => int(255)
}

var_dump(Color::hexa_to_rgb('#fff555'));
array(3) {
  'R' => int(255)
  'G' => int(245)
  'B' => int(85)
}

var_dump(Color::hexa_to_rgb('frfrfr', 'string'));
(bool)false

Unit Tests

composer exec phpunit

Author

Hugo Maugey visit my website ;), (*9)

The Versions

17/03 2017

dev-master

9999999-dev

PHP Color Utilities

  Sources   Download

The Development Requires