# dark-mode-ts

> React TypeScript dark mode

Latest version **1.2.6** (published 2023-01-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install dark-mode-ts
pnpm add dark-mode-ts
yarn add dark-mode-ts
bun add dark-mode-ts
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.6 |
| Published | 2023-01-01 |
| First published | 2022-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Artsiom Pchaliankou |
| Maintainers | craziestbee |
| Keywords | dark-mode-ts, dark-mode-vite, color, darkmode, dark, light, react, react hooks, react-typescript, npm, dark-light-mode, swith, theme-swither, toggle, theme-toggle, vite-theme-toggle, vite-typescript |

## Links

- npm: https://www.npmjs.com/package/dark-mode-ts
- Repository: https://github.com/ArtemPchela/dark-mode-ts
- Homepage: https://github.com/ArtemPchela/dark-mode-ts#readme
- Issues: https://github.com/ArtemPchela/dark-mode-ts/issues
- npm.io page: https://npm.io/package/dark-mode-ts

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.6 (latest) — 2023-01-01
- 1.2.5 — 2022-12-31
- 1.2.4 — 2022-12-29
- 1.2.3 — 2022-12-28
- 1.2.2 — 2022-12-28
- 1.2.1 — 2022-12-22
- 1.2.0 — 2022-12-22
- 1.1.5 — 2022-12-22
- 1.1.4 — 2022-12-22
- 1.1.3 — 2022-12-22
- 1.1.2 — 2022-12-22
- 1.1.1 — 2022-12-22
- 1.1.0 — 2022-12-22

## README

# dark-mode-ts

[![Npm package total](https://badgen.net/npm/dt/dark-mode-ts)](https://npmjs.com/package/dark-mode-ts)
[![Npm package version](https://badgen.net/npm/v/dark-mode-ts)](https://npmjs.com/package/dark-mode-ts)
[![Npm package license](https://badgen.net/npm/license/lodash)](https://npmjs.com/package/dark-mode-ts)
[![Npm package daily downloads](https://badgen.net/npm/dw/dark-mode-ts)](https://npmjs.com/package/dark-mode-ts)
[![Npm package daily downloads](https://badgen.net/npm/dd/dark-mode-ts)](https://npmjs.com/package/dark-mode-ts)

> NOTE:
> 
> dark-mode-ts based on TypeScript, "react": "^18.2.0" and "react-dom": "^18.2.0".
> 
> Works with **React**, **React TypeScript**, **React Vite**, **React Vite TypeScript**. 
> 
> The user setting persists to **`localStorage`**.

### dark-mode-ts:

<ul>
    <li>a minimal lightweight component for your React projects</li>
    <li>quickly setup</li>
    <li>has a small bundle size and zero dependencies</li>
    <li>you have total control with styles - css, scss, sass, tailwind ui.</li>
</ul>

Like it, ⭐ it [GitHub](https://github.com/ArtemPchela/dark-mode-ts)

```jsx
import React from 'react';
import {Theme} from "dark-mode-ts";
import yourDarkImage from './path/to/your/DarkImage.png'
import yourLightImage from './path/to/your/LightImage.png'

const NameYourComponent = () => {
  return (
    <div>
      <Theme
        darkIcon={yourDarkImage}
        lightIcon={yourLightImage}
        altDark='dark icon'
        altLight="light icon"
        imgWidth='50'
        imgHeight='50'
        myClass="your-class_name"
      />
    </div>
  )
};
```

A React theme component accepts the following props:

| Key         | Type   | Description                                                          |
|:------------|:-------|:---------------------------------------------------------------------|
| `darkIcon`  | string      | Work with .png, .jpg, .svg<sup>*</sup> extensions.                   |
| `lightIcon` | string      | Work with .png, .jpg, .svg<sup>*</sup> extensions.                   |
| `altDark`   | string | For better accessibility.                                            |
| `altLight`  | string | For better accessibility.                                            |
| `imgWidth`    | string | Width for your icon.                                                 |
| `imgHeight`   | string | Height for your icon.                                                |
| `myClass`   | string | If you want to have background or add hover effect for icon wrapper. |

<sup>*</sup> - Don't **forget**, **svg** has width and height by **default**.

## Add your global styles. Example:

```css
:root {
  --background-color: #007aff;
  --color-text: white;
}

[data-theme='light'] {
  --background-color: #227d2c;
  --color-text: black
}

body {
  background: var(--background-color);
  color: var(--color-text);
}
```

## Installation

```sh
$ npm i dark-mode-ts
```

---
_Source: https://npm.io/package/dark-mode-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
