Directory

← Back

color-picker

A picker for color, that can use the native input

Author

Contributors

Rating

Popularity

<100

Published on NPM Published on webcomponents.org Published on Vaadin  Directory

API & Demo

<color-picker>

What is it for?

color-picker is a picker for color for Polymer that can use the native input, too. It has the same approach like in <datetime-picker>. If the native picker is choosen and is not supported, this element use the polyfill color-picker. The <color-element> will come in place if the native picker is not available or is not explicitly wanted. The value and color-string will give you directly the css-string in the selected format.

Motivation

Internally it tests the browser, if native input-type color is supported. You can decide to use the native or the replacements during runtime. color-element can also be used separately. By default, the polyfilled version is used.

It might be useful for you to use, if you like to keep the native approach of Browsers on Mobile Devices, or you like to have a different look or you would like to have a guaranteed working color-picker. Another use case could be for example, if you want on mobile devices use the native picker, when supported, and on desktop devices this polyfill.

For that purposes the attributes native and native-on-mobile are provided.

  <datetime-picker native></datetime-picker>
  <datetime-picker native-on-mobile></datetime-picker>

How?

The component page explains, which of the attributes you can use and how. You can see there a demo, too.

Examples:

color-picker

<color-picker r="{{r}}" g="{{g}}" b="{{b}}" default="green" native="[[native]]" auto-confirm="[[autoConfirm]]"></color-picker>  
<p>
  <span> red: [[r]] </span>
  <br>
  <span> green: [[g]] </span>
  <br>
  <span> blue: [[b]] </span>  
  <br>
  <br>
  <input type="checkbox" checked="{{native::change}}">native color picker
  <br>
  <br>
  <input type="checkbox" checked="{{autoConfirm::change}}">auto confirm
</p>

Stand-alone color-element

  <color-element alpha="{{alpha}}" r="{{r}}" g="{{g}}" b="{{b}}" h="{{h}}" s="{{s}}" l="{{l}}" format="{{format}}"></color-element><br>
  <p>
    <span>format </span>
    <select id="formats" value="{{format::change}}">
      <option value="auto">auto</option>
      <option value="rgb">rgb</option>
      <option value="hex">hex</option>
      <option value="hsl">hsl</option>
    </select>
    <br>
    <input type="range" min="0" max="1" step="0.01" value="{{alpha::change}}"><span> alpha: [[alpha]] </span>
    <br>
    <input type="range" min="0" max="255" step="1" value="{{r::input}}"><span> red: [[r]] </span>
    <br>
    <input type="range" min="0" max="255" step="1" value="{{g::input}}"><span> green: [[g]] </span>
    <br>
    <input type="range" min="0" max="255" step="1" value="{{b::input}}"><span> blue: [[b]] </span>
    <br>
    <input type="range" min="0" max="359" step="1" value="{{h::input}}"><span> hue: [[h]] </span>
    <br>
    <input type="range" min="0" max="1" step="0.001" value="{{s::input}}"><span> saturation: [[s]] </span>
    <br>
    <input type="range" min="0" max="1" step="0.001" value="{{l::input}}"><span> lightness: [[l]] </span>
    <br>
  </p>

Use the polyfill or the native picker

By default it checks if color is supported for a native input. If it is not and you have set native, the polyfill will be used instead of the native input. Additionally there is the attribute native-on-mobile.

Styling

Have a look at input-picker-pattern#input-shared-style to see how to style the element.

Installation

npm install --save @fooloomanzoo/color-picker

Contribute?

Feel free to send a new issue, a commit, a pull request or just fork it!

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Dependencies

  • @fooloomanzoo/color-input#^3.0.4
  • @fooloomanzoo/input-picker-pattern#^3.0.10
  • @polymer/polymer#^3
Released
2018-11-17
Maturity
IMPORTED
License
MIT License

Compatibility

Framework
Polymer 1.0+
Polymer 3.0+
Polymer 2.0+ in 2.0.11
Browser
Browser Independent

Locale ComboBox Add-on - Vaadin Add-on Directory

Locale ComboBox Add-on for Vaadin Flow Locale ComboBox Add-on - Vaadin Add-on Directory
Vaadin ComboBox extension that allows to choose between multiple locales. #### Features * Displays the locale name alongside its corresponding country flag * Allows to specify which locales are available for selection * Provides an option to change the current session locale #### Found a bug or have a suggestion? Report it on GitHub For bug reports, feature suggestions, or questions, please open an issue on [GitHub](https://github.com/FlowingCode/LocaleComboBox/issues). This makes it easier for us to track and respond efficiently, ensuring you get the best possible support. Your input helps us improve—thank you!
View on GitHub
Issue tracker
Online Demo
Author Homepage

Locale ComboBox Add-on version 1.0.1
Initial release

Online