Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ufukbakan/color-scheme-hook
Color scheme hook for React
https://github.com/ufukbakan/color-scheme-hook
javascript npm react reactjs typescript
Last synced: 4 days ago
JSON representation
Color scheme hook for React
- Host: GitHub
- URL: https://github.com/ufukbakan/color-scheme-hook
- Owner: ufukbakan
- Created: 2022-11-20T11:05:52.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-20T12:08:44.000Z (almost 2 years ago)
- Last Synced: 2024-12-18T06:23:28.628Z (16 days ago)
- Topics: javascript, npm, react, reactjs, typescript
- Language: JavaScript
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
color-scheme-hook
Returns the system's preferred scheme by default. It's going to be overridden when toggled.
## Installation
```bash
npm install color-scheme-hook
```## Usage
```jsx
import { useDarkMode, useLightMode } from "color-scheme-hook";export default function MyReactComponent(){
const [isDarkMode, toggleColorScheme, resetPreference] = useDarkMode();
const [isLightMode, toggleColorScheme, resetPreference] = useLightMode();
}
```