Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-use-system-color-mode

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-system-color-mode

[Check out the example on **CodeSandbox**](https://codesandbox.io/s/condescending-jennings-59h6r?file=/src/styles.css)

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 22 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc