All Projects → kleinfreund → vue-accessible-color-picker

kleinfreund / vue-accessible-color-picker

Licence: MIT license
A color picker component for Vue.js 3.

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects

Projects that are alternatives of or similar to vue-accessible-color-picker

ColorPickerLib
A WPF/MVVM implementation of a themeable color picker control.
Stars: ✭ 44 (-18.52%)
Mutual labels:  color-picker
ColorPicker
A HSV style Color Picker Dialog library for Android (with Alpha setting)
Stars: ✭ 16 (-70.37%)
Mutual labels:  color-picker
PDColorPicker
🎨 A simple, fast color picker for iOS apps.
Stars: ✭ 30 (-44.44%)
Mutual labels:  color-picker
andColorPicker
Color picker library for Android
Stars: ✭ 233 (+331.48%)
Mutual labels:  color-picker
react-native-color-panel
React Native Color Panel Component for iOS and Android 🏳️‍🌈
Stars: ✭ 21 (-61.11%)
Mutual labels:  color-picker
Cheesebaron.ColorPickers
Sample library with ports of different Color Picker implementations.
Stars: ✭ 14 (-74.07%)
Mutual labels:  color-picker
Sharex
ShareX is a free and open source program that lets you capture or record any area of your screen and share it with a single press of a key. It also allows uploading images, text or other types of files to many supported destinations you can choose from.
Stars: ✭ 18,143 (+33498.15%)
Mutual labels:  color-picker
reinvented-color-wheel
A vanilla-js touch-friendly HSV color picker inspired by Farbtastic Color Picker.
Stars: ✭ 43 (-20.37%)
Mutual labels:  color-picker
meazure
Screen magnification, measurement, capture and color sampling for Windows.
Stars: ✭ 55 (+1.85%)
Mutual labels:  color-picker
vscode-color
Helper with GUI to generate color codes such as CSS color notations.
Stars: ✭ 88 (+62.96%)
Mutual labels:  color-picker
vue-uix
Vue components based on the JUI components available in Vue.js
Stars: ✭ 15 (-72.22%)
Mutual labels:  color-picker
react-native-image-color-picker
Image color picker based on image source provided and return image different color palettes or average color palette
Stars: ✭ 25 (-53.7%)
Mutual labels:  color-picker
colr pickr
Colr Pickr, a vanilla JavaScript color picker component built with SVGs, with features like saving colors. Similar design to the chrome-dev-tools color picker.
Stars: ✭ 27 (-50%)
Mutual labels:  color-picker
RandomKolor
🎨 A tiny (Kotlin) library for generating attractive colors
Stars: ✭ 46 (-14.81%)
Mutual labels:  color-picker
pikko
Color picker for iOS made with ❤️
Stars: ✭ 34 (-37.04%)
Mutual labels:  color-picker
Powertoys
Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on PowerToys overviews and how to use the utilities, or any other tools and resources for Windows development environments, head over to docs.microsoft.com!
Stars: ✭ 65,024 (+120314.81%)
Mutual labels:  color-picker
SwiftColorWheel
Delightful color picker wheel for iOS in Swift.
Stars: ✭ 37 (-31.48%)
Mutual labels:  color-picker
WearColorPicker
A lightweight color picker library for Android Wear.
Stars: ✭ 23 (-57.41%)
Mutual labels:  color-picker
RAScrollablePickerView
Lightweight HSB color picker view.
Stars: ✭ 39 (-27.78%)
Mutual labels:  color-picker
color-picker
Implementation of an HSV color picker
Stars: ✭ 23 (-57.41%)
Mutual labels:  color-picker

vue-accessible-color-picker

Tests passing

A color picker component for Vue.js 3.

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.

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

<template>
	<ColorPicker />
</template>

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

When using Vue’s options API, the component must first be registered using the components property on the Vue instance.

<template>
	<ColorPicker />
</template>

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

export default {
	components: {
		ColorPicker,
	},
}
</script>

Unstyled component:

If you want to use the unstyled variant of the component, you need to adjust the import statement to use the module specifier “vue-accessible-color-picker/unstyled”:

import { ColorPicker } from 'vue-accessible-color-picker/unstyled'

Documentation

Props

color

  • Description: Sets the color of the color picker. You can pass any valid CSS color string or an object matching the internal color representation for an HSL, HSV, HWB, or RGB color.

  • Type: string, ColorHsl, ColorHsv, ColorHwb, or ColorRgb

  • Required: false

  • Default: #ffffffff

  • Usage:

     <ColorPicker color="hsl(270 100% 50% / 0.8)" />
     <ColorPicker color="#f80b" />
     <ColorPicker :color="{ h: 0.75, s: 1, l: 0.5, a: 0.8 }" />
     <template>
     	<ColorPicker
     		:color="color"
     		@color-change="updateColor"
     	/>
     </template>
    
     <script setup>
     import { ref } from 'vue'
     import { ColorPicker } from 'vue-accessible-color-picker'
    
     const color = ref('hsl(270 100% 50% / 0.8)')
    
     function updateColor (eventData) {
     	color.value = eventData.cssColor
     }
     </script>

visibleFormats

  • Description: A list of visible color formats. Controls for which formats the color input elements are shown and in which order the formats will be cycled through when activating the format switch button.

  • Type: VisibleColorFormat[]

  • Required: false

  • Default: ['hex', 'hsl', 'hwb', 'rgb']

  • Usage:

     <ColorPicker :visible-formats="['hsl', 'hwb']" />

defaultFormat

  • Description: The color format to show by default when rendering the color picker. Must be one of the formats specified in visibleFormats.

  • Type: VisibleColorFormat

  • Required: false

  • Default: 'rgb'

  • Usage:

     <ColorPicker default-format="hwb" />

alphaChannel

  • Description: Whether to show input controls for a color’s alpha channel. If set to 'hide', the alpha range input and the alpha channel input are hidden, the “Copy color” button will copy a CSS color value without alpha channel, and the object emitted in a color-change event will have a cssColor property value without alpha channel.

  • Type: 'show' or 'hide'

  • Required: false

  • Default: 'show'

  • Usage:

     <ColorPicker alpha-channel="hide" />

id

  • Description: The ID value will be used to prefix all input elements’ id and label elements’ for attribute values. Set this prop if you use multiple instances of the color-picker component on one page.

  • Type: string

  • Required: false

  • Default: 'color-picker'

  • Usage:

     <ColorPicker id="color-picker-1" />

Events

color-change

  • Description: An input event is emitted each time the internal colors object is updated.

  • Data: The event emits an object containing both the internal colors object and a CSS color value as a string based on the currently active format. The cssColor property will respect alphaChannel.

     {
     	colors: {
     		hex: string
     		hsl: ColorHsl
     		hsv: ColorHsv
     		hwb: ColorHwb
     		rgb: ColorRgb
     	}
     	cssColor: string
     }
  • Usage:

     <template>
     	<ColorPicker
     		color="hsl(270 100% 50% / 0.8)"
     		@color-change="updateColor"
     	/>
     </template>
    
     <script setup>
     import { ColorPicker } from 'vue-accessible-color-picker'
    
     function updateColor (eventData) {
     	console.log(eventData)
     }
     </script>

Slots

hue-range-input-label

  • Description: Overrides the content of the hue range input’s label element.
  • Default content: Hue

alpha-range-input-label

  • Description: Overrides the content of the alpha range input’s label element.
  • Default content: Alpha

copy-button

  • Description: Overrides the content of the copy button element.
  • Default content: Copy color (and SVG icon)

format-switch-button

  • Description: Overrides the content of the format switch button element.
  • Default content: Switch format (and SVG icon)

Versioning

This package uses semantic versioning.

Design

The color picker consists of the following main elements:

  • Color space:

    For fine-tuning the saturation and lightness/value, a slice of the HSV cylinder for the currently selected hue is shown.

    The HSV cylinder is more convenient for this task than the HSL cylinder as it shows a color at 100% saturation and 100% value in the top right corner (i.e. one can drag the color space thumb into the corner as a quasi shortcut). The HSL cylinder’s slice has this color at the halfway point of the Y axis (i.e. at 50% lightness) which isn’t easy to select.

  • Hue slider:

    A slider for selecting the current hue. This rotates the HSV cylinder; thus, it changes the slice of the HSV cylinder that’s shown in the color space.

  • Alpha slider:

    A slider for selecting the current alpha value.

  • Copy button:

    Copies the color formatted as a CSS color string in the active format.

  • Color inputs:

    A set of text fields which allow you to enter the individual components of each color. The text fields are shown based on the active format.

  • Switch format button:

    Cycles through the available color formats (currently HEX, HSL, HWB, and RGB).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].