2.12.3 • Published 9 months ago

vanilla-picker v2.12.3

Weekly downloads
115,234
License
ISC
Repository
github
Last release
9 months ago

vanilla-picker

License Version Size Downloads

A simple, easy to use vanilla JS (no dependencies) color picker with alpha selection.

Demo

https://codepen.io/Sphinxxxx/pen/zRmKBX

Getting Started

Installing

  • For the pros:

    • npm install vanilla-picker --save
    • import Picker from 'vanilla-picker';
  • For the rest of us:

<script src="https://unpkg.com/vanilla-picker@2"></script>

Note:

The script adds a <style> element to the page, with all the needed CSS. If your site's Content Security Policy doesn't allow that, use the CSP build with a separate CSS file instead:

import Picker from 'vanilla-picker/csp';
import 'vanilla-picker/dist/vanilla-picker.csp.css';

..or

<script src="vanilla-picker.csp.min.js"></script>
<link  href="vanilla-picker.csp.css" rel="stylesheet">

Usage

<div id="parent">Click me</div>

<script>

    /*
        Create a new Picker instance and set the parent element.
        By default, the color picker is a popup which appears when you click the parent.
    */
    var parent = document.querySelector('#parent');
    var picker = new Picker(parent);

    /*
        You can do what you want with the chosen color using two callbacks: onChange and onDone.
    */
    picker.onChange = function(color) {
        parent.style.background = color.rgbaString;
    };

    /* onDone is similar to onChange, but only called when you click 'Ok' */

</script>

API and advanced options

https://vanilla-picker.js.org/gen/Picker.html

Accessibility

The color picker is built to support basic keyboard navigation and use with screen readers. I would be very interested in feedback on improvements that could be done here!

Credits

License

The ISC license - see the LICENSE.md file for details.

qcauditformbuilderqcauditformbuilderjs@prem911/formiojsauditformbuilderjswoodsaucsnova-formjs-oldsnova-formjscrmcheap-formiojsjsoneditor-index-value@infinitebrahmanuniverse/nolb-van@everything-registry/sub-chunk-3042@opengisch/geogirafe-core@geogirafe/geoportaltalkable-ui-kitt6-formiojssvelte-jsoneditorsvelte-jsoneditor-cnsvelte-jsoneditor-plussvelte-jsoneditor-taoreiciendisipsamreactfbuilderrol-formiosean-jsoneditorruntask-formiojsrich-text-tworich-text-onesupperformjsvasion-formiojsjsoneditor-mjsoneditor-modifiedjsoneditor-sg7jsoneditor-yaml-v2jsonediterjsoneditorjsoneditor-fixedinline-style-editorlit-element-pochauhdahdoahdoahf-editorjson-customgims-clientptvce_formiojsnanoformiojsnetsa_formiojsqcformiojsqloudformjssprasum-logicflow-extensionsmartformjsteson-formiojstwilight-components_test@aot-technologies/formiojs@anthonyphan/formiojs@arun-s-aot/formiojs@arextest/svelte-jsoneditor@arextest/vanilla-jsoneditor@beabee/formiojsyuchuangda-formiojsunideunicomformjsunum-formiojsvanilla-jsoneditorvanilla-jsoneditor-cnvanilla-jsoneditor-flvbvanilla-jsoneditor_yue@fbelluco/sins-formio@formio/js@formio/premium@evergis/ui@evergis/uilib-gl@formio-tmt/js@geogirafe/lib-geoportal@innovexa/idc-formiojs@logicflow/extension@ledangdung/vanilla-jsoneditor@mastermart/edienst-components@mastermart/formio-components@newhippo/formiojs@nil-/doc@ezedox/formiojs@ezedoxbp/formiojs@kit-data-manager/metadata-editor@salla.sa/twilight-components@rmorgan323/formiojs@strikehawk/jsoneditor@oneserve/formiojs@open-formulieren/formiojs@opengisch/geogirafe-lib@opengisch/gg-app@opengisch/gg-dev@opengisch/gg-lib@org-zenview/jsoneditor@sme.up/ketchup@t6engineering/formiojs@tager/admin-ui@cmtech/formiojs-4795-fix@crmcheap/formiojs@d5bitadd/ruformio.js@doublegrey/formiojsfinomial-formiojsfawriformio
2.12.3

9 months ago

2.12.2

1 year ago

2.12.0

3 years ago

2.12.1

3 years ago

2.11.2

4 years ago

2.11.1

4 years ago

2.11.0

4 years ago

2.10.1

5 years ago

2.10.0

5 years ago

2.9.2

5 years ago

2.9.1

5 years ago

2.9.0

5 years ago

2.8.2

5 years ago

2.8.1

6 years ago

2.8.0

6 years ago

2.7.2

6 years ago

2.7.1

6 years ago

2.7.0

6 years ago

2.6.0

6 years ago

2.5.3

6 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.3

6 years ago

2.4.2

6 years ago

2.4.1

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

2.0.0-alpha.8

7 years ago

2.0.0-alpha.7

7 years ago

2.0.0-alpha.6

7 years ago

2.0.0-alpha.5

7 years ago

2.0.0-alpha.4

7 years ago