Palette.Swatch

class Palette.Swatch


Represents a color swatch generated from an image's palette. The RGB color can be retrieved by calling getRgb.

Summary

Public constructors

Swatch(color: @ColorInt Int, population: Int)

Public functions

Boolean
equals(o: Any!)
@ColorInt Int

Returns an appropriate color to use for any 'body' text which is displayed over this Swatch's color.

FloatArray<Float>

Return this swatch's HSL values. hsv[0] is Hue [0 ..

Int
@ColorInt Int
@ColorInt Int

Returns an appropriate color to use for any 'title' text which is displayed over this Swatch's color.

Int
String!

Public constructors

Swatch

Added in 1.0.0
Swatch(color: @ColorInt Int, population: Int)

Public functions

equals

fun equals(o: Any!): Boolean

getBodyTextColor

Added in 1.0.0
fun getBodyTextColor(): @ColorInt Int

Returns an appropriate color to use for any 'body' text which is displayed over this Swatch's color. This color is guaranteed to have sufficient contrast.

getHsl

Added in 1.0.0
fun getHsl(): FloatArray<Float>

Return this swatch's HSL values. hsv[0] is Hue [0 .. 360) hsv[1] is Saturation [0...1] hsv[2] is Lightness [0...1]

getPopulation

Added in 1.0.0
fun getPopulation(): Int
Returns
Int

the number of pixels represented by this swatch

getRgb

Added in 1.0.0
fun getRgb(): @ColorInt Int
Returns
@ColorInt Int

this swatch's RGB color value

getTitleTextColor

Added in 1.0.0
fun getTitleTextColor(): @ColorInt Int

Returns an appropriate color to use for any 'title' text which is displayed over this Swatch's color. This color is guaranteed to have sufficient contrast.

hashCode

fun hashCode(): Int

toString

fun toString(): String!