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

ember-spectrum-color-picker

v0.10.1

Published

Simple Ember component wrapper for the Spectrum.js color picker.

Downloads

11,173

Readme

ember-spectrum-color-picker

Simple Ember color picker component based on spectrum.js.

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Installation

ember install ember-spectrum-color-picker

Usage

Example:

{{spectrum-color-picker color=teamColor}}

The color property should be set and will be updated through Ember's two-way bindings.

It's also possible to bind actions to the onChange, onMove, onShow, and onHide attributes. The action handler will receive the new color as a parameter:

{{spectrum-color-picker
    color=teamColor
    onChange=(action "colorChanged")
    onShow=(action "pickerOpened")
    onHide=(action "pickerClosed")
    onMove=(action "userMovedColorPicker")
}}

The following properties can be set to customize a particular color picker:

  • allowEmpty (default: false): whether or not the color value may be null.
  • disabled (default: false): when set to true, the color picker is disabled.
  • showInput (default: false): whether or not to show an input field in the color picker with the current color value.
  • preferredFormat (default: null): the preferred format for the color values displayed in the input. Values can be "hex", "hex3", "hsl", "rgb" or "name". When set to null, the format will adapt to a previously entered format.
  • showAlpha (default: false): whether or not to allow setting the alpha value in the color picker.
  • showInitial (default: false): whether or not to show a box with the original color for comparison.
  • showButtons (default: true): whether or not to show the 'choose' and 'cancel' buttons.
  • showPalette (default: false): whether or not to show a color palette.
  • showPaletteOnly (default: false): when set to true, only a color palette is shown.
  • palette (default: []): array of color values to show in the palette. Can be an array of arrays, where each array is a row in the palette. Pass this as a JSON string in the HBS file, like palette='[["red","lime"],["yellow","blue"]]'.
  • togglePaletteOnly (default: false): initialy shows only the palette, but a 'more' button can be clicked for custom colors.
  • showSelectionPalette (default: false): shows a palette with the colors that were picked previously by the user.
  • hideAfterPaletteSelect (default: false): when set to true, the palette will close when a color is selected.
  • maxSelectionSize (default: 7): sets the maximum number of colors shown on the palette.
  • moveFiresChange (default: false): when set to true, the color value will be updated in real time, instead of only once the user clicks the 'choose' button.
  • clickoutFiresChange (default: false): when set to true, the color value will also update when the user clicks outside the widget, instead of only once the user clicks the 'choose' button.
  • chooseText (default: 'Choose'): the text displayed on the 'choose' button.
  • cancelText (default: 'Cancel'): the text displayed on the 'cancel' button.
  • togglePaletteMoreText (default: 'More'): the text displayed on the 'more' button when togglePaletteOnly is set to true.
  • togglePaletteLessText (default: 'Less'): the text displayed on the 'less' button when togglePaletteOnly is set to true.
  • appendTo (default: 'body'): the element the color picker widget is appended to. Changing this can help resolve issues with opening the colorpicker in a modal dialog or fixed position container, for instance.
  • localStorageKey (default: 'spectrum-color-picker'): the key used for local storage when showSelectionPalette is set to true.
  • flatMode (default: false): when set to true, the color picker is always shown fully expanded.

For a more detailed documentation on these options, see the spectrum.js documentation.

If you want to set different defaults for all color pickers in your application, extend the component and override the defaults with your own:

// app/components/spectrum-color-picker.js
import SpectrumColorPickerComponent from 'ember-spectrum-color-picker/components/spectrum-color-picker';

export default SpectrumColorPickerComponent.extend({
  showInput: true,

  showAlpha: true
});

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.