dark-mode-code
v1.0.1
Published
Example in react:
Downloads
14
Maintainers
Readme
dark-mode-code
Example in react:
const darkModeCode = require('dark-mode-code')
//...
<script dangerouslySetInnerHTML={{ __html: darkModeCode }} />
//...
Features
- Automatically set
<body class="dark">
if the client OS is in dark mode. - Automatically update the former class when the client changes the mode when using the website.
- Expose a method to manually toggle the theme:
window.__toggleDarkMode()
Author
| | | ---------------------------------------------------------------------------- | | Pablo Varela |