1.3.7 • Published 3 years ago

color-picker-web-component v1.3.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

screenshot.gif]

color-picker-web-component

Read the interactive docs

A custom color picker powered by @bgins TinyColor library. This is a fork of the original (unmaintained) component by @woutervroege.

  • Supports hex, rgb(a), rrggbbaa/hex8, hsl(a) and hsv/b(a) color schemes.
  • Fully keyboard accessible
  • Supports alpha channel (default input[type=color] doesn't)

Tested browsers (older / other browsers may work)

  • Chrome >= 67
  • Firefox >= 63
  • Safari >= 10.1
  • IE11+
<color-picker
  id="picker"
  value="#ff0000"
  formats="hex,rgb,hsl,hsv,hex8"
  selectedformat="hex"
></color-picker>
picker.addEventlistener('input', (e) => console.info('input', e.detail.value))
picker.addEventlistener('change', (e) => console.info('change', e.detail.value))

Attributes

AttributeTypeDescription
darkBooleanForce dark mode when dark-mode is disabled in browser.
lightBooleanForce light mode when dark-mode is enabled in browser.
selectedformatString
no_alphaBooleanDisable alpha in color picker. Does not disable HEX8.

Properties

PropertyAttributeModifiersTypeDefaultDescription
alpha
colorreadonly
formatsformatsArray"hex","hex8","rgb","hsv","hsl"list of visible color schemes
hexreadonly
hex8readonly!
hslreadonly
hsvreadonly
rgbreadonly
selectedFormatselectedFormatString"rgb"selected color scheme
supportedFormatsreadonlystring[]
valuevalueString{"h":0,"s":1,"v":1}color value

Events

Event
change
input

CSS Custom Properties

PropertyDescription
--color-picker-background-colorbackround color
--color-picker-colortext color
1.2.0

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.2.2

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.10

3 years ago