If you're looking to implement a similar solution, you may find inspiration from this gist.
To see it in action, check out this demonstration: https://codesandbox.io/s/random-paragraph-colors-npdlp
function App() {
const randomColor = () => {
return "#" + Math.floor(Math.random() *16777215).toString(16);
};
return (
<div>
<p style={{ backgroundColor: randomColor() }}>Hi</p>
<p style={{ backgroundColor: randomColor() }}>Hello</p>
<p style={{ backgroundColor: randomColor() }}>Cool</p>
<p style={{ backgroundColor: randomColor() }}>Demo</p>
</div>
);
};
https://i.sstatic.net/hP0xo.png
A related example can be found here:
How to change each word color in react content
For more information on styling in react, visit:
https://reactjs.org/docs/faq-styling.html