'How to display hex color instead of rgb in React module?
I'm having trouble viewing the correct color format. I use inline styles taken from the parent props, in which the color is defined in hex format, but the output is a style with color in rgb format.
Parent
const Parent = () => {
const primaryColor = "#bada55";
return (
<>
<Child colors={primaryColor} />
</>
)
}
export default Parent;
Child
const Child = (props) => {
return (
<>
<div style={{ color: `${props.colors}` }}>lorem</div>
</>
)
}
export default Child;
And the output is instead of hex color, rgb <div style="color: rgb(186, 218, 85);">lorem</div>
Can you please tell me why? I need a hex value, but I don't know how to solve it.
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
