2017 © Pedro Peláez
 

library colourist

Colour manipulation library

image

mscharley/colourist

Colour manipulation library

  • Friday, September 1, 2017
  • by mscharley
  • Repository
  • 1 Watchers
  • 1 Stars
  • 407 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

colourist

Circle CI Code Climate, (*1)

Latest Stable Version Total Downloads, (*2)

Source: https://github.com/mscharley/colourist
Author: Matthew Scharley
Contributors: See contributors on GitHub
Bugs/Support: Github Issues
Copyright: 2015
License: MIT license
Status: Active, (*3)

Synopsis

colourist is a small library for PHP 5.6+ that helps ease working with colours and colour transformations., (*4)

Installation

$ composer require mscharley/colourist

Usage

$colour = \Colourist\Colour::fromHex('#ffccaa');

// Automatically conversions to calculate values you need.
$h = $colour->hue(); 
$l = $colour->lightness();
$b = $colour->brightness();

// Distinguish between different types of saturation.
$sl = $colour->hslSaturation();
$sb = $colour->hsbSaturation();

// Explicit conversions if you need them. 
$hsl = $colour->toHSL();
$sl == $hsl->saturation();
// Colours are immutable - conversions are highly cached as a result.

// Freely convert between colour spaces as required.
$hsb = $colour->toHSB();
$colour->equals($hsb->toRGB()); // TRUE

Gotchas

$colour = \Colourist\Colour::fromHex('#ffccaa');
$colour2 = \Colourist\Colour::fromHex('#aaccff');

// You must use ->equals() for comparing equality.
$colour->equals($colour2); // FALSE
$colour == $colour2; // stack overflow

The Versions

05/11 2015
05/11 2015