Home:ALL Converter>Keep colors from being converted to RGB?

Keep colors from being converted to RGB?

Ask Time:2016-08-02T02:33:52         Author:Eastonium

Json Formatter

When assigning a hsl color using Javascript, it doesn't apply it as an HSL color, but rather converts it to RGB.

document.body.style.backgroundColor = "hsl(0,100%,50%)"
document.body.style.backgroundColor; // "rgb(255, 0, 0)"

I was hoping to assign an HSL color, then modify the saturation and brightness after the fact, but I can't do that easily since it gets converted to RGB.

Is there a way to keep it from converting to RGB, or is converting it back to HSL manually necessary?

Author:Eastonium,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38705764/keep-colors-from-being-converted-to-rgb
yy