color-picker-service

provides a color picker as a service for other package

paulpflug

4,755

2

0.0.1

MIT

GitHub

This package provides the following services:

color-picker-service

provides a color picker as a service for other packages.

color-picker-service

uses the simple-color-picker

Usage

package.json

{
  "otherStuff": "otherData",
  "consumedServices": {
    "color-picker": {
      "versions": {
        "^0.0.1": "consumeColorPicker"
      }
    }
  }
}

your package:

  #in main module
  consumeColorPicker: (colorPicker) =>
    @colorPicker = colorPicker

    #where you want to use it
    @colorPicker {x:x,y:y, color: oldColor}, (newColor) ->
      #do something with new color
      #newColor will be undefined on cancel and false on "uncolor"
      unless newColor? # not canceled
        if newColor
          #has a color
        else
          #uncolor was selected