I'd like to parse a value from a variable in Javascript to a React style
property.
However, it appears that one might only be able to add opacity with the rgba
value?
Say I have:
const blueColor = "#2c8da9"
I now want to add that to a background color property in JSX with 0.2 opacity. I can do this with rgba, but it does not look nice:
backgroundColor: rgba(blueColor, 0.2)
Is there a way to achieve the same, directly referencing the hexidecimal value rather than using rgba
, to input opacity directly into, for example, a backgroundColor
property?