1.0.0 • Published 3 years ago

vue-perfect-dark-mode v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

vue-perfect-dark-mode

Version Size

This integration is for Vue 3.

Installation

You must first install perfect-dark-mode into the <head> of your document.

yarn add vue-perfect-dark-mode

Usage

In a component you can use the hook:

<script>
  import { usePerfectDarkMode } from 'vue-perfect-dark-mode'

  export default {
    name: 'App',
    setup(props) {
      const { mode, updateMode } = usePerfectDarkMode()
      return {
        mode,
        onClick() {
          updateMode(
            (mode, modes, modeIndex) => modes[(modeIndex + 1) % modes.length],
          )
        },
      }
    },
  }
</script>

<template>
  <button :class="{ visible: mode !== undefined }" @click="onClick">
    {{ mode }}
  </button>
</template>

<style>
  button {
    visibility: hidden;
  }

  .visible {
    visibility: visible;
  }
</style>
1.0.0

3 years ago

0.0.25

3 years ago

0.0.19

3 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago