react-use-system-color-mode
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.4 • Public • Published

    useSystemColorMode()

    Bundlephobia Types Build status NPM Version MIT License

    npm i react-use-system-color-mode

    A React hook for retrieving the system color mode. It is SSR compatible, built with TypeScript and listens to live changes of the system preference.

    Quick Start

    Check out the example on CodeSandbox

    import { useSystemColorMode } from 'react-use-system-color-mode'
    
    const Example = () => {
      const colorMode = useColorMode();
      
      return (
        <div>
          <h2>Your color Mode is {colorMode}</h2>
        </div>
      );
    };

    API

    useSystemColorMode()

    Returns the current color mode of the users OS. Returns dark or light. On the server it always returns dark.

    Returns 'dark' | 'light'

    Contributing

    Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

    1. Fork the Project
    2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
    3. Commit your Changes (git commit -m 'Add some AmazingFeature')
    4. Push to the Branch (git push origin feature/AmazingFeature)
    5. Open a Pull Request

    License

    Distributed under the MIT License. See LICENSE for more information.

    Contact

    Johannes Klauss - @JohannesKlauss - klauss.johannes@gmail.com

    Project Link: https://github.com/JohannesKlauss/react-use-system-color-mode

    Prior Art

    Basis of this package is the react-use-color-mode which is not maintained anymore.

    Install

    npm i react-use-system-color-mode

    DownloadsWeekly Downloads

    1

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    23.2 kB

    Total Files

    16

    Last publish

    Collaborators

    • johannesklauss