'how do i use HSL colors in react inline-styles?

How do I use a hsl color range in react for inline styles? I'm passing the below as a property to style

{backgroundColor: "hsl(100, 80%, 100%)", color: "black"}

but instead I just get an rgb like this when I inspect the element:

style="background-color: rgb(255, 255, 255); color: black;"

the code snippet is like:

const colorPill = (sim) => {
    const sat = Math.round(sim.use * 100) // map
    const pillStyle = {
        backgroundColor: `hsl(100, ${sat}%, 100%)`,
        color: 'black'
    }
    console.log('pillStyle', pillStyle)
    return (<span className='pill' style={pillStyle}>use [{sat}]</span>)
}

btw I'm trying to do something like a heatmap where an item will get redder based on a percentage value passed in. perhaps there's an easier way to do this... but without bringing in lots of packages...

references:



Solution 1:[1]

It's becoming white because the luminosity is set to 100%. For a 'pure' color, set the last number to 50%

{backgroundColor: "hsl(100, 80%, 50%)", color: "black"}

I was stuck on the same thing for far longer than I should have been. I am leaving this awnser since none of the comments really helped me realize what i was doing wrong

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Guido Queiroz