npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fooloomanzoo/color-picker

v3.0.2

Published

A picker for color, that can use the native input.

Downloads

294

Readme

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!