Color
Table of Contents
Methods
- __construct() : mixed
- Color constructor.
- createFromHex() : Color
- Creates the color from a string like #ffaabb or ffaabb.
- getAlpha() : float
- getBlue() : int
- getGreen() : int
- getRed() : int
- setAlpha() : Color
- setBlue() : Color
- setGreen() : Color
- setRed() : Color
- toHex() : string
- Returns hex representation e.g. #aabbcc.
- toRgba() : string
- Returns rgba representation, e.g. rgba(255, 0, 0, 0.5)
Methods
__construct()
Color constructor.
public
__construct([int $red = 0 ][, int $green = 0 ][, int $blue = 0 ][, float $alpha = 1.0 ]) : mixed
Parameters
- $red : int = 0
- $green : int = 0
- $blue : int = 0
- $alpha : float = 1.0
createFromHex()
Creates the color from a string like #ffaabb or ffaabb.
public
static createFromHex(string $color) : Color
Parameters
- $color : string
Return values
ColorgetAlpha()
public
getAlpha() : float
Return values
floatgetBlue()
public
getBlue() : int
Return values
intgetGreen()
public
getGreen() : int
Return values
intgetRed()
public
getRed() : int
Return values
intsetAlpha()
public
setAlpha(float $alpha) : Color
Parameters
- $alpha : float
Return values
ColorsetBlue()
public
setBlue(int $blue) : Color
Parameters
- $blue : int
Return values
ColorsetGreen()
public
setGreen(int $green) : Color
Parameters
- $green : int
Return values
ColorsetRed()
public
setRed(int $red) : Color
Parameters
- $red : int
Return values
ColortoHex()
Returns hex representation e.g. #aabbcc.
public
toHex() : string
Return values
stringtoRgba()
Returns rgba representation, e.g. rgba(255, 0, 0, 0.5)
public
toRgba() : string