Added default alpha param to ColourRGB and ColourHSL.

This commit is contained in:
flash 2023-01-02 23:20:46 +00:00
parent 28634b5db3
commit 66a35f030f
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ class ColourHSL extends Colour {
private int $green;
private int $blue;
public function __construct(float $hue, float $saturation, float $lightness, float $alpha) {
public function __construct(float $hue, float $saturation, float $lightness, float $alpha = 1.0) {
$this->hue = $hue;
$this->saturation = max(0.0, min(1.0, $saturation));
$this->lightness = max(0.0, min(1.0, $lightness));

View File

@ -11,7 +11,7 @@ class ColourRGB extends Colour {
private int $blue;
private float $alpha;
public function __construct(int $red, int $green, int $blue, float $alpha) {
public function __construct(int $red, int $green, int $blue, float $alpha = 1.0) {
$this->red = max(0, min(255, $red));
$this->green = max(0, min(255, $green));
$this->blue = max(0, min(255, $blue));