title: Change text color to white on any non-white background
body: <p>Changing the text color to white when the background color is black works great using <code>mix-blend-mode: difference</code>. Move the mouse to the text to see the effect:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const blackBox = document.querySelector(".black-box");
  window.addEventListener('mousemove', function(event) {
    blackBox.style.left = `${event.pageX - 50}px`;
    blackBox.style.top = `${event.pageY - 50}px`;
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper {
    background-color: white;
  }
  h1 {
    position: relative;
    z-index: 2;
    color: white;
    mix-blend-mode: difference;
  }
  
  .black-box {
    width: 100px;
    height: 100px;
    position: absolute;
    z-index: 1;
    background-color: black;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;h1&gt;Lorem Ipsum&lt;/h1&gt;
  &lt;/div&gt;
  &lt;div class="black-box"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This understandably doesn't result in white text if the background is anything other than black:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const box = document.querySelector(".box");
  window.addEventListener('mousemove', function(event) {
    box.style.left = `${event.pageX - 50}px`;
    box.style.top = `${event.pageY - 50}px`;
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.wrapper {
    background-color: white;
  }
  h1 {
    position: relative;
    z-index: 2;
    color: white;
    mix-blend-mode: difference;
  }
  
  .box {
    width: 100px;
    height: 100px;
    position: absolute;
    z-index: 1;
    background-image: url("https://placekitten.com/100/100")
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;h1&gt;Lorem Ipsum&lt;/h1&gt;
  &lt;/div&gt;
  &lt;div class="box"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Is there any way to make it so the text changes color from black to white as soon as the background differs from white?</p>