Closed hodashirzad closed 3 years ago
Hi there
First of all thank you very much for this package as it is very useful, unfortunately when I try to convert the pure black or white colours it fails with division by zero error:
Hex::fromString('#000000')->toHsl() Hex::fromString('#ffffff')->toHsl()
I think the following fix will sort this issue out:
In src/Convert.php line 77:
src/Convert.php
Replace this line:
$saturation = $delta / (1 - abs((2 * $lightness) - 1));
with the following:
if( $lightness > 0 && $lightness < 1) { $saturation = $delta / (1 - abs((2 * $lightness) - 1)); }else { $saturation = 0; }
Released in 1.2.4
Hi there
First of all thank you very much for this package as it is very useful, unfortunately when I try to convert the pure black or white colours it fails with division by zero error:
I think the following fix will sort this issue out:
In
src/Convert.php
line 77:Replace this line:
with the following: