An open API service indexing awesome lists of open source software.

https://github.com/rqbazan/set-initial-color-mode


https://github.com/rqbazan/set-initial-color-mode

Last synced: 5 months ago
JSON representation

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 ;
}
```