Unsolved Adapt text color depending on the background color
I would like to know if there is any way to change a text color depending on the background color.
I mean by that, if my background is black I want the text to be white if is white I want the text to be black.
Here is an example where it invert the color. But just a switch to the most readable color would be enough. :
Here a working example for HTML, CSS and JS example : https://codepen.io/jpod/pen/Aytcr
Thank you for those elements ! It will help a bit event if I believe it will not be as I expected it to be.