1.0.1 • Published 1 year ago

dark-mode-code v1.0.1

Weekly downloads
3
License
-
Repository
-
Last release
1 year ago

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

me
Pablo Varela