Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Colour Class Reference

Static Public Member Functions

static colourPalette ($name=null)
 
static rgb ($r, $g, $b, $zero_to_one_range=true)
 
static cmyk ($c, $m, $y, $k)
 
static hsv ($h, $s, $v)
 
static cmykToRgb ($input)
 
static rgbToCmyk ($input)
 
static cmykCorrect (&$input)
 
static rgbInvert ($i)
 
static rgbToHtml ($input)
 
static intToHtml ($input)
 
static intToRgb ($input, $zero_to_one_range=true)
 
static htmlToHex ($input)
 
static htmlToRgb ($input, $zero_to_one_range=true)
 
static htmlToInt ($input)
 
static rgbToInt ($input)
 
static rgbToHsv ($input)
 
static hsvToRgb ($input)
 
static htmlToHsv ($input)
 
static hsvToHtml ($input)
 
static contrastingShade ($input)
 
static twiceAsLight ($input)
 
static twiceAsDark ($input)
 
static adjustBrightness ($input, $amount)
 
static adjustContrast ($input, $amount)
 
static mix ($a, $b, $ratio=0.5)
 
static hueRotate ($input, $degrees)
 
static adjustSaturate ($input, $amount)
 
static adjustLightness ($input, $amount)
 
static hsvAdjust ($input, $h, $s, $v)
 
static hsvDifference ($a, $b)
 
static remap ($input_html, $map, $tolerance=0.2)
 

Detailed Description

Definition at line 29 of file colour.inc.

Member Function Documentation

static adjustBrightness (   $input,
  $amount 
)
static

Adjust brightness on a colour, takes values between -1 and 1

Parameters
string$inputhex string or html colour name
float$amountthe amount of brightness (-1 to 1)
Returns
string public

Definition at line 732 of file colour.inc.

static adjustContrast (   $input,
  $amount 
)
static

Adjust contrast on a colour, takes values between -1 and 1

Parameters
string$inputhex string or html colour name
float$amountthe amount of brightness (-1 to 1)
Returns
string public

Definition at line 759 of file colour.inc.

static adjustLightness (   $input,
  $amount 
)
static

Adjusts the 'lightness' or value of a colour

Parameters
string$inputhex string or html colour name
float$amount
Returns
string public

Definition at line 845 of file colour.inc.

static adjustSaturate (   $input,
  $amount 
)
static

Adjusts the 'colourfulness' or how non-grey a colour is

Parameters
string$inputhex string or html colour name
float$amount-1 to 1 (-1 = grey)
Returns
string public

Definition at line 829 of file colour.inc.

static cmyk (   $c,
  $m,
  $y,
  $k 
)
static

Create a CMYK colour

Parameters
int$cCyan
int$mMagenta
int$yYellow
int$kblacK
Returns
Array() public

Definition at line 237 of file colour.inc.

static cmykCorrect ( $input)
static

CMYK Colour corrector

Parameters
array$inputCMYK array
Returns
Array() public

Definition at line 357 of file colour.inc.

static cmykToRgb (   $input)
static

Converts CMYK to RGB - simple dodgy version

Parameters
array$inputCMYK array
Returns
Array() public

Definition at line 278 of file colour.inc.

static colourPalette (   $name = null)
static

Returns a colour palette with colour names to hex colours or a specific hex colour for the passed name

Parameters
string$namea specific name to find in the palette
Returns
mixed Array() or string if a specific name is passed public

Definition at line 40 of file colour.inc.

static contrastingShade (   $input)
static

Takes a colour and returns black or white, depending on which contrasts the most

Parameters
string$inputhex string or html colour name
Returns
string public

Definition at line 669 of file colour.inc.

static hsv (   $h,
  $s,
  $v 
)
static

Create a HSV colour

Parameters
float$hHue
float$sSaturation
float$vValue
Returns
Array() public

Definition at line 262 of file colour.inc.

static hsvAdjust (   $input,
  $h,
  $s,
  $v 
)
static

Performs all three HSV operations at once with greater accuracy

Parameters
string$inputhex string or html colour name
float$hHue
float$sSaturation
float$vValue
Returns
string public

Definition at line 864 of file colour.inc.

static hsvDifference (   $a,
  $b 
)
static

Takes two colours and returns a HSV array of values

Parameters
string$ahex string or html colour name
string$bhex string or html colour name
Returns
string public
See Also
colour_remap_new_broken

Definition at line 896 of file colour.inc.

static hsvToHtml (   $input)
static

Converts a HSV colour to a html_colour

Parameters
Array()$input HSV colour
Returns
string public

Definition at line 654 of file colour.inc.

static hsvToRgb (   $input)
static

Converts an HSV colour to a RGB colour

Parameters
Array$inputHSV colour
Returns
Array() public

Definition at line 573 of file colour.inc.

static htmlToHex (   $input)
static

Converts a hex string/colour to a hex string

Parameters
string$inputhex string or html colour name
Returns
string public

Definition at line 453 of file colour.inc.

static htmlToHsv (   $input)
static

Converts a html colour to a HSV colour

Parameters
string$inputhex string or html colour name
Returns
Array() public

Definition at line 639 of file colour.inc.

static htmlToInt (   $input)
static

Converts a hex string/colour to an integer

Parameters
string$inputhex string or html colour name
Returns
Array() public

Definition at line 498 of file colour.inc.

static htmlToRgb (   $input,
  $zero_to_one_range = true 
)
static

Converts a hex string/colour to a RGB colour

Parameters
string$inputhex string or html colour name
bool$zero_to_one_rangewhen true value are 0 to 1 range
Returns
Array() public

Definition at line 477 of file colour.inc.

static hueRotate (   $input,
  $degrees 
)
static

Rotates a colour around the colour spectrum

Parameters
string$inputhex string or html colour name
float$degrees
Returns
string public

Definition at line 813 of file colour.inc.

static intToHtml (   $input)
static

Converts an integer to a html code

Parameters
int$inputSome integer
Returns
string public

Definition at line 418 of file colour.inc.

static intToRgb (   $input,
  $zero_to_one_range = true 
)
static

Converts an integer to an rgb colour

Parameters
int$inputSome integer
bool$zero_to_one_rangewhen true value are 0 to 1 range
Returns
Array() public

Definition at line 435 of file colour.inc.

static mix (   $a,
  $b,
  $ratio = 0.5 
)
static

Mixes two colours in the desired ratio

Parameters
string$ahex string or html colour name
string$bhex string or html colour name
float$ratioration between 0 and 1
Returns
string public

Definition at line 789 of file colour.inc.

static remap (   $input_html,
  $map,
  $tolerance = 0.2 
)
static

Takes a colour and a remap array. Looks for the 'key' colours and replaces them with the 'value' colours Might work nicer in HSV colour space.

Parameters
string$input_htmlhex string or html colour name
Array$mapArray('old_colour' => 'new_colour');
float$tolerance
Returns
string public

Definition at line 927 of file colour.inc.

static rgb (   $r,
  $g,
  $b,
  $zero_to_one_range = true 
)
static

Create an RGB colour - either in 0 to 1 range or in 0 to 255 range

Parameters
int$rRed
int$gGreen
int$bBlue
bool$zero_to_one_rangewhen true value are 0 to 1 range
Returns
Array() public

Definition at line 205 of file colour.inc.

static rgbInvert (   $i)
static

Inverts an RGB value

Parameters
array$inputRGB array
Returns
Array() public

Definition at line 387 of file colour.inc.

static rgbToCmyk (   $input)
static

Converts RGB to CMYK - simple dodgy version

Parameters
array$inputRGB array
Returns
Array() public

Definition at line 315 of file colour.inc.

static rgbToHsv (   $input)
static

Converts an RGB colour to a HSV colour (Hue/Saturation/Value) r,g,b values are from 0 to 1 h = [0,360], s = [0,1], v = [0,1] if s == 0, then h = -1 (undefined) h is cyclic

Parameters
Array$inputRBG colour, with values from 0 to 1
Returns
Array() public

Definition at line 532 of file colour.inc.

static rgbToHtml (   $input)
static

Converts an RGB colour to a hex string for html colours

Parameters
array$inputRGB array
Returns
string public

Definition at line 403 of file colour.inc.

static rgbToInt (   $input)
static

Converts a rbg colour to an integer

Parameters
Array$inputRBG colour
Returns
Array() public

Definition at line 513 of file colour.inc.

static twiceAsDark (   $input)
static

Takes a colour and returns a colour twice at dark (half-way to black)

Parameters
string$inputhex string or html colour name
Returns
string public

Definition at line 711 of file colour.inc.

static twiceAsLight (   $input)
static

Takes a colour and returns a colour twice at light (half-way to white)

Parameters
string$inputhex string or html colour name
Returns
string public

Definition at line 692 of file colour.inc.


The documentation for this class was generated from the following file: