How to decide font color in white or black depending on background color?

I want to show some images like this examplealt text

The fill color is decided by a field in the data base with the color in hex (ex:ClassX -> Color: #66FFFF).
Now, I want to show data above a fill with the selected color (like in the image above) but i need to know if the color is dark or light so i know if the words should be in white or black.
Is there a way? tks

24 Answers
24

Leave a Comment