kleinfreund / vue-accessible-color-picker

A color picker component for Vue.js 3.
https://vue-accessible-color-picker.netlify.app
MIT License
115 stars 8 forks source link
color-picker component vue

vue-accessible-color-picker

Tests passing

A color picker component for Vue.js.

This package’s files are distributed in the ES module format and have not been transpiled.

Links:

Contents

Installation

npm install vue-accessible-color-picker

Usage

In a Vue single file component, import the ColorPicker component and its styles (if you want to use them).

<template>
    <ColorPicker />
</template>

<script setup>
import { ColorPicker } from 'vue-accessible-color-picker'
</script>

<style>
@import url('vue-accessible-color-picker/styles');
</style>

When using Vue’s composition API, you can directly use the component in the file’s template section once you import it.

You can also register the component and import the styles globally.

Documentation

Props

alphaChannel

color

defaultFormat

id

visibleFormats

Events

color-change

color-copy

Slots

alpha-range-input-label

copy-button

format-switch-button

hue-range-input-label

Theming

You can customize the GUI of the color picker using CSS custom properties:

:root {
    --vacp-color-focus: tomato;
    --vacp-width-border: 2px;
}

Available custom properties and their default values:

Custom property Default value
--vacp-color-background-input #fff
--vacp-color-background #fff
--vacp-color-border #000
--vacp-color-focus #19f
--vacp-color-text-input currentColor
--vacp-color-text currentColor
--vacp-font-family -apple-system, BlinkMacSystemFont, Segoe UI, Arial, sans-serif
--vacp-font-size 0.8em
--vacp-spacing 6px
--vacp-width-border 1px
--vacp-width-color-space 300px

Versioning

This package uses semantic versioning.

Design

The color picker consists of the following main elements: