Color
in package
Simple RGB color container
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- alphaBlending() : Color
- Alpha blend another color with a given opacity to this color
- blue() : int
- Returns the green blue component of this color as an int from 0 to 255
- blueF() : float
- Returns the blue color component of this color as a float from 0 to 1
- green() : int
- Returns the green color component of this color as an int from 0 to 255
- greenF() : float
- Returns the green color component of this color as a float from 0 to 1
- mixPalette() : array<int, Color>
- Mix two colors
- name() : string
- Returns the name of the color in the format "#RRGGBB"; i.e. a "#" character followed by three two-digit hexadecimal numbers.
- red() : int
- Returns the red color component of this color as an int from 0 to 255
- redF() : float
- Returns the red color component of this color as a float from 0 to 1
- stepCalc() : array{0: int, 1: int, 2: int}
- Calculate steps between two Colors
Properties
$b
private
int
$b
$g
private
int
$g
$r
private
int
$r
Methods
__construct()
public
__construct(mixed $r, mixed $g, mixed $b) : mixed
Parameters
- $r : mixed
- $g : mixed
- $b : mixed
Tags
alphaBlending()
Alpha blend another color with a given opacity to this color
public
alphaBlending(float $opacity, Color $source) : Color
Parameters
- $opacity : float
- $source : Color
Tags
Return values
Color —The new color
blue()
Returns the green blue component of this color as an int from 0 to 255
public
blue() : int
Tags
Return values
intblueF()
Returns the blue color component of this color as a float from 0 to 1
public
blueF() : float
Tags
Return values
floatgreen()
Returns the green color component of this color as an int from 0 to 255
public
green() : int
Tags
Return values
intgreenF()
Returns the green color component of this color as a float from 0 to 1
public
greenF() : float
Tags
Return values
floatmixPalette()
Mix two colors
public
static mixPalette(int $steps, Color $color1, Color $color2) : array<int, Color>
Parameters
- $steps : int
-
the number of intermediate colors that should be generated for the palette
- $color1 : Color
-
the first color
- $color2 : Color
-
the second color
Tags
Return values
array<int, Color>name()
Returns the name of the color in the format "#RRGGBB"; i.e. a "#" character followed by three two-digit hexadecimal numbers.
public
name() : string
Tags
Return values
stringred()
Returns the red color component of this color as an int from 0 to 255
public
red() : int
Tags
Return values
intredF()
Returns the red color component of this color as a float from 0 to 1
public
redF() : float
Tags
Return values
floatstepCalc()
Calculate steps between two Colors
private
static stepCalc(int $steps, array<string|int, Color> $ends) : array{0: int, 1: int, 2: int}
Parameters
- $steps : int
-
start color
- $ends : array<string|int, Color>
-
end color
Tags
Return values
array{0: int, 1: int, 2: int} —[r,g,b] steps for each color to go from $steps to $ends