From 9afcff2a62326f032d924d07ae4f105b154ef496 Mon Sep 17 00:00:00 2001 From: Nick Sagona Date: Wed, 20 Sep 2023 18:11:38 -0500 Subject: [PATCH] Patch RGB to Hex bug --- src/Color/Rgb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Color/Rgb.php b/src/Color/Rgb.php index f0fea8e..07ed993 100644 --- a/src/Color/Rgb.php +++ b/src/Color/Rgb.php @@ -245,7 +245,7 @@ public function toHsl() */ public function toHex() { - $hex = dechex($this->r) . dechex($this->g) . dechex($this->b); + $hex = str_pad(dechex($this->r), 2, '0', STR_PAD_LEFT) . str_pad(dechex($this->g), 2, '0', STR_PAD_LEFT) . str_pad(dechex($this->b), 2, '0', STR_PAD_LEFT); return new Hex($hex); }