W3.CSS Dark Mode
Dark Mode
You can switch between dark and light mode for a page or section by using the JavaScript classList
property,
along with the .w3-black
class:
Example
<script>
function myFunction() {
let x = document.body;
x.classList.toggle("w3-black");
}
</script>