@sanity/color-input
Color input for Sanity that stores selected colors in hex, hsl, hsv and rgb format.
Installation
sanity install @sanity/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:@sanity/base/schema-type
part in your 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: 09 hsl: _type: 'hslaColor' h: 24999999999999994 s: 07328000000000001 l: 0313 a: 09 hsv: _type: 'hsvaColor' h: 24999999999999994 s: 08457987072945522 v: 05423664 a: 09 rgb: _type: 'rgbaColor' r: 41 g: 21 b: 138 a: 09
License
MIT-licensed. See LICENSE.