Constructor. Create a new color.
RGBColor
RGBColor
(integer $red, integer $green, integer $blue)
-
integer
$red: The value of the red component of the color.
-
integer
$green: The value of the green component of the color.
-
integer
$blue: The value of the blue component of the color.
Darken the color by a certain amount (0-100)
void
darken
(float $percent)
-
float
$percent: The amount to darken the color by (0 keeps the color unchanged, 50 divides all color components by 2, 100 makes the color black.
Get the blue component of the color.
integer
getBlue
()
Get the green component of the color.
integer
getGreen
()
Get the red component of the color.
integer
getRed
()
get all three components of the color.
array
getRGB
()
Invert the color.
void
invert
()
Lighten the color by a certain amount (0-100)
void
lighten
(float $percent)
-
float
$percent: The amount to lighten the color by (0 keeps the color unchanged, 50 multiplies all color components by 2, 100 makes the color white.
set the blue component of the color.
void
setBlue
(integer $value)
-
integer
$value: The value to set the blue component to (0-255).
set the green component of the color.
void
setGreen
(integer $value)
-
integer
$value: The value to set the green component to (0-255).
set the red component of the color.
void
setRed
(integer $value)
-
integer
$value: The value to set the red component to (0-255).
set all three components of the color.
void
setRGB
(integer $red, integer $green, integer $blue)
-
integer
$red: The value to set the red component to (0-255).
-
integer
$green: The value to set the green component to (0-255).
-
integer
$blue: The value to set the red component to (0-255).
Shift the red component by a certain amount.
void
shiftBlue
(integer $amount)
-
integer
$amount: The amount to shift (add to or substract from) the red component by.
Shift the green component by a certain amount.
void
shiftGreen
(integer $amount)
-
integer
$amount: The amount to shift (add to or substract from) the green component by.
Shift the red component by a certain amount.
void
shiftRed
(integer $amount)
-
integer
$amount: The amount to shift (add to or substract from) the red component by.
Makes sure all the colors are within the range 0 - 255
void
_checkColors
()
Makes sure $val is within the range $min -> $max
void
_withinRange
(integer $val, integer $min, [integer $max = 255])
-
integer
$val
-
integer
$min
-
integer
$max