DEV Community

loading...

Discussion on: How to make Dynamic Text Overlays on Images

Collapse
qm3ster profile image
Mihail Malo

I'd suggest a shadow/outline for most practical uses.
For one thing, you are calculating the average of the whole image.
But imagine if most of the image is white, while exactly where the text goes is a black rectangle?
Then you have to calculate that exact position.
But what if that area is striped?

@link2twenty 's "hacky" CSS solutions will probably be more performant AND more effective, being able to invert the image color with the text.