A Vue3.x based color picker component with gradient bar control.

Overview

a Vue3.x based color picker component.

English | 中文

Features

  • Supports 3 CSS background color modes: solid, linear-gradient and radial-gradient.
  • Supports color opacity(alpha) adjustment.
  • Supports gradient bar control, easily drag/add/delete the control points.
  • The EyeDropper can quickly pick any color from your screen. (supports Google Chrome version 95+)
  • Supports live preview.

Screenshot

image

image

image

demo.mov

Installation

npm i @mcistudio/vue-colorpicker

How to Use

Global Registration

main.js

import ColorPicker from '@mcistudio/vue-colorpicker'
import '@mcistudio/vue-colorpicker/style.css'
createApp(App)
  .use(router)
  .use(ColorPicker)
  .mount("#app");
OR

Local Registration

HelloWorld.vue

<script setup>
import ColorPicker from '@mcistudio/vue-colorpicker'
import '@mcistudio/vue-colorpicker/dist/style.css'

<template>
  <ColorPicker></ColorPicker>
</template>

script>

demo

HelloWorld.vue

">
<template>
  <ColorPicker mode="mode" :degree="degree" :gradients="grad" @colorChanged="triggerChanged" />
template>

<script setup>
import ColorPicker from '@mcisutdio/vue-colorpicker'
import '@mcisutdio/vue-colorpicker/dist/style.css'
import { ref } from 'vue'
const mode = ref('linear')
const degree = ref(90)
const grad = ref([
  { id: 0, percent: 10, color: { r: 255, g: 10, b: 20, a: 1 } },
  { id: 1, percent: 100, color: { r: 59, g: 50, b: 240, a: 1 } },
])
function triggerChanged(color) {
  console.log('current color:', color)
}
script>

Props

Prop Name Description Type Accepted Value Default Value Required
mode color mode String solid
linear
radial
solid No
degree drgee value in Linear-gradient mode Number - 90 No
color rgba color value in solid mode String - { r: 0, g: 0, b: 0, a: 1 } No
gradients gradient list
JSON Array - [
{
percent: 0,
color: { r: 255, g: 255, b: 255, a: 1 }
}
{
percent: 100,
color: { r: 0, g: 0, b: 0, a: 1
}
}
]
No

Events

event Name Description Parameters
colorChanged triggered when the color is changed returnValue
returnValue examples:

Solid Mode

{
    "mode": "solid",
    "color": {
        "r": 0,
        "g": 0,
        "b": 0,
        "a": 1
    },
    "css": "background-color:rgba(0,0,0,1)"
}

Linear Mode

{
    "mode": "linear",
    "degree": 90,
    "color": [
        {
            "percent": 0,
            "color": {
                "r": 255,
                "g": 255,
                "b": 255,
                "a": 1
            }
        },
        {
            "percent": 100,
            "color": {
                "r": 0,
                "g": 0,
                "b": 0,
                "a": 1
            }
        }
    ],
    "css": "background-image:linear-gradient(90deg,rgba(255,255,255,1) 0%,rgba(0,0,0,1) 100%)"
}

Radial Mode

{
    "mode": "radial",
    "color": [
        {
            "percent": 0,
            "color": {
                "r": 255,
                "g": 255,
                "b": 255,
                "a": 1
            }
        },
        {
            "percent": 100,
            "color": {
                "r": 0,
                "g": 0,
                "b": 0,
                "a": 1
            }
        }
    ],
    "css": "background-image:radial-gradient(rgba(255,255,255,1) 0%,rgba(0,0,0,1) 100%)"
}
You might also like...
Radial Color Picker - Vue
Radial Color Picker - Vue

Radial Color Picker - Vue Introduction Great UX starts with two basic principles - ease of use and simplicity. Selecting a color should be as easy as

🎨  Lightweight color picker for Vue 3
🎨 Lightweight color picker for Vue 3

🎨 Lightweight color picker for Vue 3

Color Picker app, created by tauri.
Color Picker app, created by tauri.

Color Picker 取色器 ✨ 特性 一键取色并复制到剪贴板 保留历史取色记录 自定义颜色值类型(如:HEX, RGB 等) 自定义取色快捷键(默认:F2) 颜色值去重 历史记录:左键单击显示颜色值,左键双击复制颜色值到剪贴板,右键单击删除颜色 可隐藏界面取色 软件安装包小,占用内存少 🌴

Color picker chrome-style only
Color picker chrome-style only

one-colorpicker A Chrome-style ColorPicker Install $ npm install one-colorpicker Quick Start import {ColorPicker, ColorPanel} from 'one-colorpicker'

Color picker for vue using Tailwind v2
Color picker for vue using Tailwind v2

Vue Tailwind Color Picker Color picker for vue using Tailwind v2. Requires Tailwind Live demo Installation $ npm install vue-tailwind-color-picker $ y

Cordelia Vue - a VueJS plugin that allows you to add a rich color picker into your web pages

Color picker for web and mobile browsers. Vue plugin version of Cordelia Color Picker library.

Color Picker base on Vue2.x

Color Picker base on Vue2.x

Vue color picker

Vue color picker Iro color picker for Vue. Demo See demo here Install npm install vue-iro-color-picker --save Usage import ColorPicker from 'vue-iro-

vue3-ts-picker 一款基于 vue3+ts 的轻量级颜色取色器插件

vue3-ts-picker 一款基于 vue3+ts 的轻量级颜色取色器插件

Owner
null
A Nice Color Gradient Picker with Vue

Vue Color Gradient Picker Table of Contents Installation Examples Demos Installation To install, you can use npm or yarn: $ npm install vue-color-grad

Arthur Hayrapetyan 42 Dec 14, 2022
Vue gradient picker component

vue-gpickr Vue gradient picker component. Inspired by gpickr and vue-color Demo Usage npm i vue-gpickr <template> <vue-gpickr v-model="gradient" />

null 77 Dec 11, 2022
Vue Color Picker using native input type color.

Lightweight color picker that uses the native HTML element input type color.

David Custódio 14 Sep 21, 2022
:art: Vue Color Pickers for Sketch, Photoshop, Chrome & more http://vue-color.surge.sh

vue-color Color Pickers for Sketch, Photoshop, Chrome & more with Vue.js(vue2.0). Live demo Installation NPM $ npm install vue-color CommonJS var Phot

Don 2.4k Dec 29, 2022
Tailwind Gradient Generator

Tailwind Gradient Generator Link: Tailwind Gradient Generator Feel free to collaborate. Contributing Are you interested in contributing to the project

reg 31 Dec 9, 2022
🎨 A natural color picker component for Vue.js

Color picker for Vue.js A Vue.js color picker component designed for humans. Installation npm i --save-dev vue-color-picker-board Browser Include the

Shlomi Nissan 11 Nov 24, 2022
🎨 A Color picker component. Built from the bottom to work with Vue.js.

Verte A Complete Vue.js Color Picker Component Features Multiple Color Models support: RGB, HSL, and HEX. SSR Friendly. Small file size, only 7kb gzip

Baianat 159 Dec 26, 2022
Accessible color picker component for Vue.js

vue-accessible-color-picker An accessible Vue.js color picker component. Links: demo npmjs.com/package/vue-accessible-color-picker on BundlePhobia git

Philipp Rudloff 69 Dec 28, 2022
A color picker vue component

A color picker vue component

Benny Schudel 0 Feb 8, 2021
Color picker Vue.js component

vue-colorpicker Color picker Vue.js component.

Jamena McInteer 3 Jul 13, 2018