I'm using Tailwind CSS in my React app.
Tailwind has classes like "text-blue-600"
to set the text color, and you can also use colors that are not predefined using something like "text-[#50d71e]"
.
For icons I use the Heroicons library.
At one point I have some logic to change the color of one of the icons. Something like:
let colorClass = 'text-black'
if (isCorrect) {
colorClass = 'text-[#F8D000]';
}
const icon = <TrophyIcon className={colorClass} />;
This worked on my first tests, but after playing with the app for some time I noticed the custom color is not applied all the time, sometimes it behaves like it doesn't find it.