title: Changing CSS pseudo-element styles via JavaScript
body: <p>Is it possible to change a CSS pseudo-element style via JavaScript?</p>
  
  <p>For example, I want to dynamically set the color of the scrollbar like so:</p>
  
  <pre><code>document.querySelector("#editor::-webkit-scrollbar-thumb:vertical").style.background = localStorage.getItem("Color");
  </code></pre>
  
  <p>and I also want to be able to tell the scrollbar to hide like so:</p>
  
  <pre><code>document.querySelector("#editor::-webkit-scrollbar").style.visibility = "hidden";
  </code></pre>
  
  <p>Both of these scripts, however, return:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'style' of null</p>
  </blockquote>
  
  <p>Is there some other way of going about this?<br>
  Cross-browser interoperability is not important, I just need it to work in webkit browsers.</p>