Coder Social home page Coder Social logo

vue-channel-color-picker's Introduction

Vue Channel Color Picker

Example

Version Downloads License Size

An easy to use channel based RGB, CMYK & Graytone color picker.

Demo

Basic

Installation

npm install --save vue-channel-color-picker

Usage

ES6 modules

<template>
  <div id="app">
    <div class="app-wrapper">
      <channel-color-picker :color="color" @color-change="colorChanged" />
    </div>
  </div>
</template>

<script>
export default {
  name: "App",
  data() {
    return {
      color: {
        type: "cmyk",
        channels: [0, 0, 0, 0]
      }
    };
  },
  methods: {
    colorChanged(color) {
      this.color = color;
    }
  }
};
</script>

Register ChannelColorPicker component globally.

// main.js
import Vue from 'vue';

import VueChannelColorPicker from 'vue-channel-color-picker';

import App from './App.vue';

Vue.use(VueChannelColorPicker);

Vue.config.productionTip = false;

new Vue({
  render: h => h(App)
}).$mount('#app');

CommonJS

const VueChannelColorPicker = require('vue-channel-color-picker');

In a script tag, this loads the component using the global Vue instance.

<script src="https://unpkg.com/vue-channel-color-picker"></script>

Properties

color: object
The color object in RGB, CMYK or Gray and its channels.

{
  type: "cmyk",
  channels: [0, 0, 0, 0]
}
{
  type: "rgb",
  channels: [0, 0, 0]
}
{
  type: "gray",
  channels: [0]
}


colorTypes: Array or String
The color types to use in the color picker.\

  • Note: If the type of the current color you are using is missing in this list, it will be added.
[
  'RGB',
  'CMYK'
]


colorPreset: Array
Adds some pre-defined colors.
Color given can be any css-valid color String.
Or, ofcourse, a type + channel.

  • Note: Maximum 14 colors can be shown at the time
[
  'red',
  '#ffaaa',
  'rgb(255, 255, 255)',
  {
    type: "cmyk",
    channels: [0, 0, 0, 0]
  }
]

Events

@color-change
Triggered when the color has been changed, returns the color object.


@is-open
Triggered when the colorpicker is being toggled, returns current state

Contributing

Checkout GitHub issues for any issues we need some help with.

# Serve with hot reload (default at localhost:8080)
vue serve --open src/channelColorPicker/ColorPicker.vue

# Build all variants
npm run bundle

License

MIT

vue-channel-color-picker's People

Watchers

James Cloos avatar Mike de Snoo avatar

Forkers

denbrian

vue-channel-color-picker's Issues

Disabling some of the pickers

Hi,

I want to be able to only pick CMYK colours. I see there are props called gray, rgb and cmyk that are booleans, but it doesn't look like it uses them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.