use-dark-mode-ts
v1.0.2
Published
A small package containing a dark mode react hook based upon a css listener.
Downloads
1,272
Maintainers
Readme
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>)
}
</>
)
}