First found this via mix using basic red #FF0000 and blue #0000FF and a mixture of values, and end up with a bunch of hex values with fewer than six digits, some of which simply don't work at all.
Reading through the twig extensions, the _hslToHex() function works to prevent this right before the return value. I ended up rewriting it to work with _rgbToHex().
I think this works as the result seems correct.
// Make sure we get 2 digits for decimals
$hex[0] = (strlen("".$hex[0])===1) ? "0".$hex[0]:$hex[0];
$hex[1] = (strlen("".$hex[1])===1) ? "0".$hex[1]:$hex[1];
$hex[2] = (strlen("".$hex[2])===1) ? "0".$hex[2]:$hex[2];
First found this via
mix
using basic red#FF0000
and blue#0000FF
and a mixture of values, and end up with a bunch of hex values with fewer than six digits, some of which simply don't work at all.Reading through the twig extensions, the
_hslToHex()
function works to prevent this right before the return value. I ended up rewriting it to work with_rgbToHex()
.I think this works as the result seems correct.