There is a css property that does exactly what you want, but support is a bit limited (without IE / Edge).
mix-blend-mode difference , . ( ).
CSS mix-blend-mode , .
:
html, body{height:100%}
.game {
width: 100%;
height: 100%;
background:url('http://www.intrawallpaper.com/static/images/rainbow_texture679.jpg') 0% 50% no-repeat;
animation: moveBG 10s linear infinite;
}
.gui {
color:grey;
padding:25px;
line-height:1.4;
mix-blend-mode: difference;
}
@keyframes moveBG {
0% {background-position: 0% 50%;}
25% {background-position: 50% 0%;}
50% {background-position: 100% 50%;}
75% {background-position: 50% 100%;}
100% {background-position: 0% 50%;}
}
<div class="game">
<div class="gui">
Ellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis ornare metus sed justo pulvinar dapibus. Cras posuere leo quis semper lacinia. Pellentesque vitae ligula ut magna interdum tincidunt. Integer est velit, congue eget quam nec, feugiat malesuada nulla. Sed nisi lacus, pharetra mattis dapibus ac, hendrerit ac quam. Nulla facilisi.
</div>
</div>
Hide result
( ) box-shadow, @Rourin ( mix-blend-mode ), CSS canvas ( ).