# simple-theme-switcher

> A small web component for switching themes.

Latest version **1.0.4** (published 2022-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-theme-switcher
pnpm add simple-theme-switcher
yarn add simple-theme-switcher
bun add simple-theme-switcher
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2022-03-05 |
| First published | 2022-02-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Craig Fox |
| Maintainers | craigwfox |
| Keywords | web component, theme switcher, dark mode, simple theme switcher |

## Links

- npm: https://www.npmjs.com/package/simple-theme-switcher
- Repository: https://github.com/craigwfox/simple-theme-switcher
- Homepage: https://github.com/craigwfox/simple-theme-switcher#readme
- Issues: https://github.com/craigwfox/simple-theme-switcher/issues
- npm.io page: https://npm.io/package/simple-theme-switcher

## Recent versions

- 1.0.4 (latest) — 2022-03-05
- 1.0.3 — 2022-03-02
- 1.0.2 — 2022-02-22
- 1.0.1 — 2022-02-22
- 1.0.0 — 2022-02-17

## README

# Theme switcher

A small web component for switching themes. I've tried to make it fairly flexible and barebones. There are some minor styles included that you can manually add to your project.

- Github: [https://github.com/craigwfox/simple-theme-switcher](https://github.com/craigwfox/simple-theme-switcher)
- NPM: [https://www.npmjs.com/package/simple-theme-switcher](https://www.npmjs.com/package/simple-theme-switcher)

## Usage

```HTML
<link rel="stylesheet" href="./node_modules/simple-theme-switcher/styles.css" />

<button is="theme-switcher"
  modes="light, dark"
  dataAttr="data-theme"
  current="light"
  aria-label="Change to dark mode"
  aria-live="polite">
  <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="square" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><path d="M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4"/></svg>
</button>

<script src="./node_modules/simple-theme-switcher/simple-theme-switcher.js"></script>
```

## Todo

- LocalStorage for the prefs
- Maybe swap to checkboxes (this needs more research on what is better)

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