RSI helpers  0.1
RSI helpers
Color Class Reference

Color helpers. More...

Static Public Member Functions

static intToRgb ($value)
 Convert integer color to triplet array. More...
 
static hexToRgb ($value)
 Convert hexadecimal color to triplet array. More...
 
static toRgb ($value)
 Parse color to triplet array. More...
 
static toInt ($value)
 Parse color to integer. More...
 
static toHex ($value)
 Parse color to hexadecimal. More...
 
static grey ($value)
 Grey value of a color. More...
 
static tint ($value, $tint)
 Lighten (tint) or darken (shade) a color. More...
 
static palette ($count=12)
 Create a color palette (rainbow). More...
 

Static Protected Member Functions

static decToHex ($value)
 Format a color value to two digit hexadecimal. More...
 

Detailed Description

Color helpers.

Default color notation is a triplet array with byte values for red, green, and blue.

Definition at line 9 of file Color.php.

Member Function Documentation

◆ decToHex()

static decToHex (   $value)
staticprotected

Format a color value to two digit hexadecimal.

Parameters
byte$valueColor value (0..255).
Returns
string Two digit hexadecimal representation.

Definition at line 57 of file Color.php.

◆ grey()

static grey (   $value)
static

Grey value of a color.

Parameters
mixed$valueColor as hexadecimal string (3 or 6 digits, with or without leading #), integer, or triplet array.
Returns
byte Grey scale value (0..255).

Definition at line 73 of file Color.php.

◆ hexToRgb()

static hexToRgb (   $value)
static

Convert hexadecimal color to triplet array.

Parameters
mixed$valueColor as hexadecimal string (3 or 6 digits, with or without leading #).
Returns
array Color as triplet array.

Definition at line 24 of file Color.php.

◆ intToRgb()

static intToRgb (   $value)
static

Convert integer color to triplet array.

Parameters
mixed$valueColor in integer notation.
Returns
array Color as triplet array.

Definition at line 16 of file Color.php.

◆ palette()

static palette (   $count = 12)
static

Create a color palette (rainbow).

Parameters
int$countNumber of colors in the palette.
Returns
array Array with colors.

Definition at line 94 of file Color.php.

◆ tint()

static tint (   $value,
  $tint 
)
static

Lighten (tint) or darken (shade) a color.

Parameters
mixed$valueColor as hexadecimal string (3 or 6 digits, with or without leading #), integer, or triplet array.
float$tintTint (0..1 makes a color lighter, with 1 = white; -1..0 makes a color darker, with -1 = black).
Returns
array Color as triplet array.

Definition at line 82 of file Color.php.

◆ toHex()

static toHex (   $value)
static

Parse color to hexadecimal.

Parameters
mixed$valueColor as hexadecimal string (3 or 6 digits, with or without leading #), integer, or triplet array.
Returns
array Color as hexadecimal string.

Definition at line 65 of file Color.php.

◆ toInt()

static toInt (   $value)
static

Parse color to integer.

Parameters
mixed$valueColor as hexadecimal string (3 or 6 digits, with or without leading #), integer, or triplet array.
Returns
array Color as integer.

Definition at line 49 of file Color.php.

◆ toRgb()

static toRgb (   $value)
static

Parse color to triplet array.

Parameters
mixed$valueColor as hexadecimal string (3 or 6 digits, with or without leading #), integer, or triplet array.
Returns
array Color as triplet array.

Definition at line 38 of file Color.php.


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