tailwind-dark-mode-code

1.0.0 • Public • Published

tailwind-dark-mode-code

Example in react:

const darkModeCode = require('tailwind-dark-mode-code')

//...
  <script dangerouslySetInnerHTML={{ __html: darkModeCode }} />
//...

Features

  • Automatically set <html 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.
  • Compatible with Tailwind built-in theme changer (using LocalStorage).

Author

me
Pablo Varela

/tailwind-dark-mode-code/

    Package Sidebar

    Install

    npm i tailwind-dark-mode-code

    Weekly Downloads

    0

    Version

    1.0.0

    License

    none

    Unpacked Size

    1.59 kB

    Total Files

    3

    Last publish

    Collaborators

    • pablopunk