Dark Mode
To add dark mode to your site, add two CSS variables named
--white
and --black
to your
<body>
tag, each with the opposite value.
<body style="--white: black; --black: white;">
<h1>
Hi!
</h1>
<p>
This page has dark mode.
</p>
</body>
# Toggle
Adding a dark mode toggle button to your page is easy. Just paste the
following code into the <head>
section of your page:
<script src="https://declass.netlify.app/js/toggle.js" defer></script>
Support | Chrome | Safari | Firefox | Edge | Opera |
---|---|---|---|---|---|
Dark Mode | 49+ | 9.1+ | 31+ | 16+ | 36+ |
Information for this support table comes from Can I Use.