GithubHelp home page GithubHelp logo

anand-gopinath / ember-pickr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from astronomersiva/ember-pickr

0.0 3.0 0.0 6.16 MB

Color Picker for EmberJS using pickr

Home Page: https://astronomersiva.github.io/ember-pickr/

License: MIT License

JavaScript 90.93% HTML 9.07%

ember-pickr's Introduction

ember-pickr Build Status

Color Picker for EmberJS using pickr

Demo & Documentation

Installation

ember install ember-pickr

Usage

{{color-picker
  value=value
  default="#e04e39"
  format="hexa"
}}

Options

Takes all options that are applicable to pickr.

  • disabled: Start state. If true, 'disabled' will be added to the button's classlist | false
  • default: Default color | #fff
  • comparison: If set to false it would directly apply the selected color on the button and preview | true
  • defaultRepresentation: Default color representation. Valid options are HEX, RGBA, HSVA, HSLA and CMYK | HEX
  • showAlways: Option to keep the color picker always visible | false
  • closeWithKey: Close pickr with this specific key. Can be the event key or code | Escape
  • position: Defines the position of the color-picker. Available options are top, left and middle relative to the picker button. If clipping occurs, the color picker will automatically choose his position. | middle
  • adjustableNumbers: Enables the ability to change numbers in an input field with the scroll-wheel. To use it set the cursor on a position where a number is and scroll, use ctrl to make steps of five | true
  • saveLabel: Button label for save button | Save
  • clearLabel: Button label for clear button | Clear
  • format: One of hsva, hsla, rgba, hexa, cmyk | { h, s, v, a }
  • To use the onChange and onSave handlers, use closure actions.
{{color-picker
  value=value
  default="#e04e39"
  format="hexa"
  saveLabel="Set Color"
}}

The onSave and onChange handlers can take two parameters - hsva and instance where hsva is an HSVa color object and instance is the current instance of Pickr. The HSVa object has toHSVA, toHSLA, toRGBA, toHEXA, toCMYK, and clone methods that return the converts the object into corresponding arrays. You can call toString on the resulting array to get the string representation of the colors.

  • To toggle components inside the color picker, you can pass the following options to the components property:
{
  palette: true,  // Will be overwritten with true if preview, opacity or hue are true
  preview: true,
  opacity: true,
  hue: true,

  interaction: {
    hex: true,
    rgba: true,
    hsva: true,
    input: true,
    clear: true,
    save: true
  }
}

License

This project is licensed under the MIT License.

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.