Change the color of a webpage dynamically using JS and CSS
By Flavio Copes
Learn how to change a web page colors on the fly with JavaScript and the CSS filter property, switching between pastel, grayscale, and normal modes.
~~~
Here’s how to dynamically change a web page’s colors using the CSS filter property and JavaScript:
<a href='javascript:document.querySelector("html").setAttribute("style","filter: saturate(60%) brightness(80%);")'>
pastel
</a>
<a href='javascript:document.querySelector("html").setAttribute("style","filter: grayscale(100%); ")'>
grayscale
</a>
<a href='javascript:document.querySelector("html").setAttribute("style","filter: ")'>
normal
</a>~~~
Related posts about js: