# change-theme-button

> A button to change the theme for the current website

Latest version **1.0.0** (published 2020-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install change-theme-button
pnpm add change-theme-button
yarn add change-theme-button
bun add change-theme-button
```

## 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.0 |
| Published | 2020-07-29 |
| First published | 2020-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 174.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Herson Salinas |
| Maintainers | hersonhn |

## Links

- npm: https://www.npmjs.com/package/change-theme-button
- Repository: https://github.com/HersonHN/change-theme-button
- Homepage: https://github.com/HersonHN/change-theme-button#readme
- Issues: https://github.com/HersonHN/change-theme-button/issues
- npm.io page: https://npm.io/package/change-theme-button

## Dependencies (2)

- [vue](https://npm.io/package/vue.md) ^2.6.11
- [core-js](https://npm.io/package/core-js.md) ^3.6.4

## Recent versions

- 1.0.0 (latest) — 2020-07-29
- 0.2.4 — 2020-07-29
- 0.2.3 — 2020-07-24
- 0.2.2 — 2020-05-27
- 0.1.5 — 2020-05-16
- 0.1.4 — 2020-05-16
- 0.1.3 — 2020-05-16
- 0.1.1 — 2020-05-15
- 0.1.0 — 2020-05-15

## README

# Change Theme Button

A button to change the theme for the current website

It:

- Is build in Vue.js v3
- Includes a compiled version to use in the website without running Vue's server
- Saves the selected theme in the `localStorage`.
- Alternatively you cand bind `v-model` to save it somewhere else.
- Show 3 options: Light Theme, Dark Theme and System Theme (this one being dynamic according to your configurations)
- Includes an SCSS file as a base for the theme configuration.


## Before use

1. Include on your website the `scss/colors.scss` style.

    ```css
    @import "change-theme-button/scss/colors";
    ```

    If you're not using sass, you can use `public/style.css` instead.

2. Set on your page's `<body>` the theme of the website, you can use the system-theme to make it dynamic.

    ```html
    <body class="system-theme">
    ```


## Installing

```bash
npm install --save change-theme-button
```


## Calling the Library

```javascript
import ChangeThemeButton from 'change-theme-button';
```


## Calling it on Project Without Vue

```javascript
import { Vue, ChangeThemeButton } from 'change-theme-button/src/lib';

new Vue({
  components: { ChangeThemeButton }
}).$mount('#global-content');
```


## Available Themes

There's 3 themes you can use on your website

- `system-theme`
- `light-theme`
- `dark-theme`

## Options

You can add different options to the `<chage-theme>`:

- `icon-name`: change the class of the icon, you can use that to chage the icon to match your site's theme.
- `set-color-on-load`: (true by default) loads the theme on page load.
- `target`: (empty by default) Set the `querySelector` for element who will receive the theme class, if empty, the `<body>` will receive it.
- `v-model`: binds the name of the theme to a variable instead of saving it to the localStorage.

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