Swatch
Class: Swatch
Represents a color swatch generated from an image’s palette.
Constructors
new Swatch()
new Swatch(rgb, population): SwatchInternal use.
Parameters
rgb
[r, g, b]
population
number
Population of the color in an image
Returns
Defined in
Accessors
b
Get Signature
get b(): numberThe blue value in the RGB value
Returns
number
Defined in
bodyTextColor
Get Signature
get bodyTextColor(): stringReturns an appropriate color to use for any ‘body’ text which is displayed over this Swatch’s color.
Returns
string
Defined in
g
Get Signature
get g(): numberThe green value in the RGB value
Returns
number
Defined in
hex
Get Signature
get hex(): stringThe color value as a hex string
Returns
string
Defined in
hsl
Get Signature
get hsl(): Vec3The color value as a hsl value
Returns
Defined in
population
Get Signature
get population(): numberReturns
number
Defined in
r
Get Signature
get r(): numberThe red value in the RGB value
Returns
number
Defined in
rgb
Get Signature
get rgb(): Vec3The color value as a rgb value
Returns
Defined in
titleTextColor
Get Signature
get titleTextColor(): stringReturns an appropriate color to use for any ‘title’ text which is displayed over this Swatch’s color.
Returns
string
Defined in
Methods
toJSON()
toJSON(): objectGet the JSON object for the swatch
Returns
object
population
population: number;rgb
rgb: Vec3;Defined in
applyFilters()
static applyFilters(colors, filters): Swatch[]Parameters
colors
Swatch[]
filters
Filter[]
Returns
Swatch[]
Defined in
clone()
static clone(swatch): SwatchMake a value copy of a swatch based on a previous one. Returns a new Swatch instance