class Color

Methods

static 
fixRgb($r, $g = 0, $b = 0)

Allow array pr parameter form for RGB

static array
rgb(string $hex)

Convert a hex color to RGB.

static array
hex($r, $g = false, $b = false)

Convert a RGB to hex

static float
luminance(int $r, int $g = false, int $b = false)

Calculate the relative luminance of an RGB color.

static float
relativeLuminance(string $C1, string $C2)

Calculate the relative luminance of two colors.

Details

at line 12
static fixRgb($r, $g = 0, $b = 0)

Allow array pr parameter form for RGB

Parameters

$r
$g
$b

at line 24
static array rgb(string $hex)

Convert a hex color to RGB.

Parameters

string $hex

BADA55

Return Value

array [186, 218, 85]

at line 35
static array hex($r, $g = false, $b = false)

Convert a RGB to hex

Parameters

$r
$g
$b

Return Value

array [186, 218, 85]

at line 53
static float luminance(int $r, int $g = false, int $b = false)

Calculate the relative luminance of an RGB color.

Parameters

int $r
int $g
int $b

Return Value

float

at line 71
static float relativeLuminance(string $C1, string $C2)

Calculate the relative luminance of two colors.

Parameters

string $C1 hex color
string $C2 hex color

Return Value

float