# @uiw/react-use-colorscheme

> useColorScheme() provides access to the devices color scheme.

Latest version **1.0.0** (published 2023-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @uiw/react-use-colorscheme
pnpm add @uiw/react-use-colorscheme
yarn add @uiw/react-use-colorscheme
bun add @uiw/react-use-colorscheme
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-08-12 |
| First published | 2023-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Kenny Wong |
| Maintainers | uiwjs, wcjiang |
| Keywords | react-use-colorscheme, colorscheme, react.js, react, hooks, template, monorepo, monorepo-template, uiw, uiw-react, react-component, component, components, ui, css, uikit, react-ui, framework |

## Links

- npm: https://www.npmjs.com/package/@uiw/react-use-colorscheme
- Repository: https://github.com/uiwjs/react-use-colorscheme
- Homepage: https://uiwjs.github.io/react-use-colorscheme
- Issues: https://github.com/uiwjs/react-use-colorscheme/issues
- npm.io page: https://npm.io/package/@uiw/react-use-colorscheme

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-08-12
- 0.0.1 — 2023-08-12

## README

React useColorScheme() Hook
===

[![Build & Deploy](https://github.com/uiwjs/react-use-colorscheme/actions/workflows/ci.yml/badge.svg)](https://github.com/uiwjs/react-use-colorscheme/actions/workflows/ci.yml)
[![Coverage Status](https://uiwjs.github.io/react-use-colorscheme/badges.svg)](https://uiwjs.github.io/react-use-colorscheme/coverage/lcov-report/)
[![NPM Version](https://img.shields.io/npm/v/@uiw/react-use-colorscheme.svg)](https://www.npmjs.com/package/@uiw/react-use-colorscheme)
[![react@^18](https://shields.io/badge/react-^18-green?style=flat&logo=react)](https://github.com/facebook/react/releases)

`useColorScheme()` is a tiny, zero-dependency, SSR hook for responding to devices color scheme changes.

## Quick Start

```bash
npm install @uiw/react-use-colorscheme
```

## Using

```jsx mdx:preview
import React from "react";
import { useColorScheme } from '@uiw/react-use-colorscheme';

export default function App() {
  const colorScheme = useColorScheme();
  return (
    <div>
      <h1 style={{ margin: 0 }}>useColorScheme</h1>
      <div>{colorScheme === 'dark' ? '🌒 dark' : '🌞 light'}</div>
      <p>Test by setting light and dark themes in your OS</p>
      <img style={{ maxWidth: 520 }} src="https://github.com/uiwjs/react-use-online/assets/1680273/38090578-258c-496d-afdb-0493677e12f9" />
    </div>
  );
}
```

## Related

- [useOnline](https://github.com/uiwjs/react-use-online) `useOnline` is a tiny, zero-dependency hook for responding to online/offline changes.

## Contributors

As always, thanks to our amazing contributors!

<a href="https://github.com/uiwjs/react-use-colorscheme/graphs/contributors">
  <img src="https://uiwjs.github.io/react-use-colorscheme/CONTRIBUTORS.svg" />
</a>

Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).

## License

Licensed under the MIT License.

---
_Source: https://npm.io/package/@uiw/react-use-colorscheme · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
