JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q28888F
  • License MIT

Vue.js directive for apply random colors to CSS properties of HTML element.

Package Exports

  • vue-random-colors
  • vue-random-colors/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vue-random-colors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Logo

vue-random-colors

Vue 3.x directive for apply random colors to CSS properties of element. By default directive use 216 web safe colors. More info at https://websafecolors.info Colors could be re-defined by user, see options section below.

Version for Vue 2.x can be found here https://github.com/acidbeast/vue-random-colors

Install

$ npm i --save vue-random-colors

And then

import Vue from 'vue'
import VueRandomColor from 'vue-random-colors'

Vue.use(VueRandomColor)

Usage

Basic example

  <div v-random-color>
  ...
  </div>

Options

  • property (string) - CSS property to apply color. { background | border | color }. By default: background.
  • event (string) - Event which evoke color change. By default: mouseover.
  • default (string) - Default color which apply in case of mouseout or mouseleave. By default: 'ffffff'
  • colors (array) - List of colors defined by user.
  • transition (number) - Speed of CSS property transition.

Example

  <div v-random-color="{
    colors: [ 'aaaaaa', 'cccccc', 'eeeeee' ],
    event: 'click',
    property: 'border',
    default: 'ff0000',
    transition: 0.5
  }">
  ...
  </div>

Demo

Here

License

MIT

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

For detailed explanation on how things work, consult the docs for vue-loader.