1.1.3 • Published 2 years ago
use-prefers-color-scheme v1.1.3
use-prefers-color-scheme
React hook for determining the preferred color scheme
Features:
- SSR support
- Written in Typescript
Install
npm install --save use-prefers-color-scheme
Usage
Tip When rendered in node (SSR) the hook returns
no-preference
.
import React from 'react'
import usePrefersColorScheme from 'use-prefers-color-scheme'
const App = () => {
const prefersColorScheme = usePrefersColorScheme()
const isDarkMode = prefersColorScheme === 'dark'
return (
<div>You are using {isDarkMode ? 'Dark Mode 🌚' : 'Light Mode 🌞'}!</div>
)
}
Online Demo
License
MIT © rfoel
1.1.3-0943d0e.0
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.3-6b0b94a.3
2 years ago
1.1.3-6b0b94a.2
2 years ago
1.1.3-6b0b94a.4
2 years ago
1.1.3-6b0b94a.1
2 years ago
1.1.3-6b0b94a.0
2 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.0
3 years ago
0.1.2-rc.3
3 years ago
0.1.2-rc.4
3 years ago
0.1.2-rc.0
3 years ago
0.1.2-rc.1
3 years ago
0.1.2-rc.2
3 years ago
0.1.1
5 years ago
0.1.0
5 years ago