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