@lyra/color-input
Color input
Last updated a year ago by bjoerge .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @lyra/color-input 
SYNC missed versions from official npm registry.

@lyra/color-input

Color input for Lyra that stores selected colors in hex, hsl, hsv and rgb format.

Installation

lyra install @lyra/color-input

Usage

Use it in your schema types:

// [...]
{
  fields: [
    // [...]
    {
      name: 'favoriteColor',
      title: 'Favorite color',
      type: 'color'
    }
  ]
}

Note that the above only works if you import and use the all:part:@lyra/base/schema-type part in your schema. If you do not import this part to your schema, you can import the color schema from part:@lyra/color-input/schema.

Options

To disable the alpha option, set disableAlpha to true:

// ...fields...
{
  name: 'favoriteColor',
  title: 'Favorite color',
  type: 'color',
  options: {
    disableAlpha: true
  }
}

Data model

{
  _type: 'color',
  hex: '#29158a',
  alpha: 0.9,
  hsl: {
    h: 249.99999999999994,
    s: 0.7328000000000001,
    l: 0.313,
    a: 0.9
  },
  hsv: {
    h:249.99999999999994,
    s: 0.8457987072945522,
    v: 0.5423664,
    a: 0.9
  },
  rgb: {
    r: 41
    g: 21,
    b: 138,
    a: 0.9
  }
}

License

MIT-licensed. See LICENSE.

Current Tags

  • 0.3.0                                ...           latest (a year ago)

4 Versions

  • 0.3.0                                ...           a year ago
  • 0.2.5                                ...           2 years ago
  • 0.2.4                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |