belongs to Maven artifact androidx.palette:palette:1.0.0-alpha1

Palette.Swatch

public static final class Palette.Swatch
extends Object

java.lang.Object
   ↳ 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

Palette.Swatch(int color, int population)

Public methods

boolean equals(Object o)
int getBodyTextColor()

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

float[] getHsl()

Return this swatch's HSL values.

int getPopulation()
int getRgb()
int getTitleTextColor()

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

int hashCode()
String toString()

Inherited methods

Public constructors

Palette.Swatch

Palette.Swatch (int color, 
                int population)

Parameters
color int

population int

Public methods

equals

boolean equals (Object o)

Parameters
o Object

Returns
boolean

getBodyTextColor

int getBodyTextColor ()

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

Returns
int

getHsl

float[] getHsl ()

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

Returns
float[]

getPopulation

int getPopulation ()

Returns
int the number of pixels represented by this swatch

getRgb

int getRgb ()

Returns
int this swatch's RGB color value

getTitleTextColor

int getTitleTextColor ()

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

Returns
int

hashCode

int hashCode ()

Returns
int

toString

String toString ()

Returns
String