From 66a35f030f9eec02d8e51710c7de2161d2a1796f Mon Sep 17 00:00:00 2001 From: flashwave Date: Mon, 2 Jan 2023 23:20:46 +0000 Subject: [PATCH] Added default alpha param to ColourRGB and ColourHSL. --- src/Colour/ColourHSL.php | 2 +- src/Colour/ColourRGB.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Colour/ColourHSL.php b/src/Colour/ColourHSL.php index 5463b54..abd34b6 100644 --- a/src/Colour/ColourHSL.php +++ b/src/Colour/ColourHSL.php @@ -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)); diff --git a/src/Colour/ColourRGB.php b/src/Colour/ColourRGB.php index 0e15537..25105f6 100644 --- a/src/Colour/ColourRGB.php +++ b/src/Colour/ColourRGB.php @@ -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));