Swatch

class Swatch
kotlin.Any
   ↳ androidx.palette.graphics.Palette.Swatch

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

Summary

Public constructors

<init>(color: Int, population: Int)

Public methods

Boolean
equals(other: Any?)

Int

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

FloatArray

Return this swatch's HSL values.

Int

Int

Int

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

Int

String

Public constructors

<init>

Swatch(color: Int, population: Int)

Public methods

equals

fun equals(other: Any?): Boolean

getBodyTextColor

fun getBodyTextColor(): 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

@NonNull fun getHsl(): FloatArray

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

fun getPopulation(): Int
Return
Int: the number of pixels represented by this swatch

getRgb

fun getRgb(): Int
Return
Int: this swatch's RGB color value

getTitleTextColor

fun getTitleTextColor(): 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