Swatch
Class: Swatch
Represents a color swatch generated from an image’s palette.
Constructors
new Swatch()
new Swatch(rgb, population): Swatch
Internal use.
Parameters
rgb
[r, g, b]
population
number
Population of the color in an image
Returns
Defined in
Accessors
b
Get Signature
get b(): number
The blue value in the RGB value
Returns
number
Defined in
bodyTextColor
Get Signature
get bodyTextColor(): string
Returns 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(): number
The green value in the RGB value
Returns
number
Defined in
hex
Get Signature
get hex(): string
The color value as a hex string
Returns
string
Defined in
hsl
Get Signature
get hsl(): Vec3
The color value as a hsl value
Returns
Defined in
population
Get Signature
get population(): number
Returns
number
Defined in
r
Get Signature
get r(): number
The red value in the RGB value
Returns
number
Defined in
rgb
Get Signature
get rgb(): Vec3
The color value as a rgb value
Returns
Defined in
titleTextColor
Get Signature
get titleTextColor(): string
Returns an appropriate color to use for any ‘title’ text which is displayed over this Swatch’s color.
Returns
string
Defined in
Methods
toJSON()
toJSON(): object
Get 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): Swatch
Make a value copy of a swatch based on a previous one. Returns a new Swatch instance