33 if (!is_integer(
$r) or $r < 0 || $r > 255) {
34 throw new \InvalidArgumentException(
"Unexpected value for \$r: '$r'");
36 if (!is_integer(
$g) or $g < 0 || $g > 255) {
37 throw new \InvalidArgumentException(
"Unexpected value for \$g: '$g'");
39 if (!is_integer(
$b) or $b < 0 || $b > 255) {
40 throw new \InvalidArgumentException(
"Unexpected value for \$b: '$b'");
97 foreach ($this->
asArray() as $value) {
98 $hex .= str_pad(dechex($value), 2,
'0', STR_PAD_LEFT);
111 . implode(
', ', $this->
asArray())
125 $sum = 0.299 * $this->
r + 0.587 * $this->
g + 0.114 *
$this->b;
g()
Get the valule for green.
Color expresses a certain color by giving the mixing ratio in the RGB color space.
asHex()
Return color-value in hex-format.
asRGBString()
Return string with RGB-notation.
b()
Get the valule for blue.
isDark()
Based on https://de.wikipedia.org/wiki/Luminanz this function decides if the color can be considered ...
asArray()
Return array with RGB-values.
r()
Get the valule for red.