ColorUtils
in package

Table of Contents

formatHex()  : string
Format string as hex.
hexDarker()  : string
Hex darker/lighter/contrast functions for colours.
hexLighter()  : string
Hex darker/lighter/contrast functions for colours.
lightOrDark()  : string
Detect if we should use a light or dark colour on a background colour.
rgbFromHex()  : string
Hex darker/lighter/contrast functions for colours.

Methods

formatHex()

Format string as hex.

public static formatHex(string $hex) : string
Parameters
$hex : string
Return values
string

hexDarker()

Hex darker/lighter/contrast functions for colours.

public static hexDarker(mixed $color[, int $factor = 30 ]) : string
Parameters
$color : mixed
$factor : int = 30

(default: 30)

Return values
string

hexLighter()

Hex darker/lighter/contrast functions for colours.

public static hexLighter(mixed $color[, int $factor = 30 ]) : string
Parameters
$color : mixed
$factor : int = 30

(default: 30)

Return values
string

lightOrDark()

Detect if we should use a light or dark colour on a background colour.

public static lightOrDark(mixed $color[, string $dark = '#000000' ][, string $light = '#FFFFFF' ]) : string
Parameters
$color : mixed
$dark : string = '#000000'

(default: '#000000')

$light : string = '#FFFFFF'

(default: '#FFFFFF')

Return values
string

rgbFromHex()

Hex darker/lighter/contrast functions for colours.

public static rgbFromHex(mixed $color) : string
Parameters
$color : mixed
Return values
string

Search results