I wanted to add some spans dynamically with hsl background-color applied to style attribute, like this:
<span style="background-color: hsl(190, 75%, 43%)"></span>
Here is my jQuery doing this:
var hues = [ 172, 178, 184, 190, 196, 202, 208 ];
$.each(hues, function(index, backgroundHue) {
var newSpan = $('<span></span>');
newSpan.css('background-color', 'hsl('+backgroundHue+', 75%, 43%)');
someBlock.append(newSpan);
});
But as a result i got span with rgb() background color (auto-converted from hsl()):
<span style="background-color: rgb(27, 165, 192);"></span>
Here is a fiddle: https://jsfiddle.net/pbjcvwdh/5/
Can anyone explain why is this and is there any way to avoid this auto-conversion? If I apply background-color statically in html it doesn't change to rgb().