Coder Social home page Coder Social logo

ivanvmat / color-picker Goto Github PK

View Code? Open in Web Editor NEW
20.0 0.0 5.0 13.15 MB

:droplet: Flat and simple color-picker library. No dependencies, no jquery.

Home Page: https://ivanvmat.github.io/color-picker/

License: MIT License

CSS 16.94% JavaScript 80.69% HTML 2.37%
color picker color-picker js js-library widget design ux-design ux-ui tools

color-picker's Introduction

Flat and simple color-picker

gzip size brotli size No dependencies Current version Support me


Demo

Features

  • Simple: The interface is straight forward and easy to use.
  • Practical: Multiple color representations. Multiple themes.
  • Mobile-friendly: Works well on mobile devices and touch screens.
  • No dependencies

Themes

Dark Light
Dark theme Light theme

Getting Started

Note: The readme is always up-to-date with the latest commit. See Releases for installation instructions regarding to the latest version.

Browser

<link rel="stylesheet" href="dist/color-picker.min.css"/>
<script type="text/javascript" src="dist/color-picker.min.js"></script>

Usage

// Simple example, see optional options for more configuration.
const picker = new ColorPickerControl({ 
    container: document.body, 
    theme: 'dark' 
});

You can find more examples here.

Events

Use the on(event, cb) and off(event, cb) functions to bind / unbind event listener.

Event Description Arguments
open Color picker got opened ColorPickerControlInstance
change Color has changed HSVaColorObject
close Color picker got closed ColorPickerControlInstance

Example:

picker.on('open', (instance) => {
    console.log('Event: "open"', instance);
});
picker.on('change', (color) => {
    console.log('Event: "change"', color);
});
picker.on('close', (instance) => {
    console.log('Event: "close"', instance);
});

color-picker's People

Contributors

ivanvmat avatar relistan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

color-picker's Issues

.fromHex

The .color.fromHex function does nothing even after .update is called

Debouncing multiple events on mouseclick

Hi Ivan
when clicking on the color wheel in a webbrowser multiple "picker.on('change', function(color))" events get triggered within ~20ms. This is not the case when typing in new numbers. It is not an issue with physical keeping the button pressed; I made some tests with an clicking script. Is there a way to debounce or otherwise mitigate this behavior?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.