https://github.com/rqbazan/set-initial-color-mode
https://github.com/rqbazan/set-initial-color-mode
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rqbazan/set-initial-color-mode
- Owner: rqbazan
- License: mit
- Created: 2021-01-02T23:18:06.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-19T01:00:12.000Z (11 months ago)
- Last Synced: 2024-11-19T01:37:18.017Z (11 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@rqbazan/set-initial-color-mode
- Size: 65.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Set Initial Color Mode 🌗
## Inspiration
[The Quest for the Perfect Dark Mode](https://www.joshwcomeau.com/react/dark-mode/) by [Josh Comeau](https://twitter.com/JoshWComeau)
## Usage
### Plain HTML
```html
```
### Next.js
```jsx
import NextDocument, { Head, Html, Main, NextScript } from "next/document";
import { getJsText } from "@rqbazan/set-initial-color-mode";export default class Document extends NextDocument {
render() {
return (
);
}
}
```### React.js
```jsx
import * as React from "react";
import { useColorModeToggle } from "@rqbazan/set-initial-color-mode";function Switch() {
const { onToggle } = useColorModeToggle();return ;
}
```