Tsugi

Color
in package

Table of Contents

Methods

fixRgb()  : mixed
Allow array pr parameter form for RGB
hex()  : array<string|int, mixed>
Convert a RGB to hex
luminance()  : float
Calculate the relative luminance of an RGB color.
relativeLuminance()  : float
Calculate the relative luminance of two colors.
rgb()  : array<string|int, mixed>
Convert a hex color to RGB.

Methods

fixRgb()

Allow array pr parameter form for RGB

public static fixRgb(mixed $r[, mixed $g = 0 ][, mixed $b = 0 ]) : mixed
Parameters
$r : mixed
$g : mixed = 0
$b : mixed = 0

hex()

Convert a RGB to hex

public static hex(mixed $r[, mixed $g = false ][, mixed $b = false ]) : array<string|int, mixed>
Parameters
$r : mixed
$g : mixed = false
$b : mixed = false
Return values
array<string|int, mixed> —

[186, 218, 85]

luminance()

Calculate the relative luminance of an RGB color.

public static luminance(int $r[, int $g = false ][, int $b = false ]) : float
Parameters
$r : int
$g : int = false
$b : int = false
Return values
float

relativeLuminance()

Calculate the relative luminance of two colors.

public static relativeLuminance(string $C1, string $C2) : float
Parameters
$C1 : string

hex color

$C2 : string

hex color

Return values
float

rgb()

Convert a hex color to RGB.

public static rgb(string $hex) : array<string|int, mixed>
Parameters
$hex : string

#BADA55

Return values
array<string|int, mixed> —

[186, 218, 85]


        
On this page

Search results