use-dark-mode-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

UseDarkMode hook

This is a very simple react hook to detect dark mode and return you a boolean value if it is dark mode or not.

Example usage:

import { useDarkMode } from 'use-dark-mode-ts';

const ExampleComponent = () => {
    const isDarkMode = useDarkMode();

    return (
        <>
            {
                isDarkMode
                ? (<div>I am in dark mode </div>)
                : (<div>I am not in dark mode </div>)
            }
        </>
    )
}

Package Sidebar

Install

npm i use-dark-mode-ts

Weekly Downloads

126

Version

1.0.2

License

Apache-2.0

Unpacked Size

16.5 kB

Total Files

7

Last publish

Collaborators

  • devwillholmes