Change Text Color Relative To Background

Hi everyone!
I am looking for a way to change the color of a text (only between white and black) in relation to the background photo, in the background I have a full-screen slideshow that reproduces several random photos.

The idea would be that if the background is mostly dark, the text is WHITE, if the background is lighter, the text is BLACK

Does anyone know a method to accomplish this?

Well, the idea would be to add a class to the background pictures, e.g. 'dark' for the dark ones and 'light' for the lighter ones (surprising... :thinking::grinning: ) Depending on the class of the randomly chosen picture you can change the text color to black or white (using timelines or javascript/styles)

1 Like

contrastColorForTextBasedOnImage.hype.zip (737,0 KB)
stitcht together ... principle should work

//////
takes an average color of an image, checks the brightness of this color and sets text to black or white correspondingly
//////

the weakness of this request and approach is that an image may have dark AND light parts ...

3 Likes

thanks i will try it