added in version 22.1.0
belongs to Maven artifact com.android.support:palette-v7:28.0.0-alpha1

Palette.Swatch

public static final class Palette.Swatch
extends Object

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

From class java.lang.Object

Public constructors

Palette.Swatch

added in version 22.1.0
Palette.Swatch (int color, 
                int population)

Parameters
color int

population int

Public methods

equals

boolean equals (Object o)

Parameters
o Object

Returns
boolean

getBodyTextColor

added in version 22.1.0
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

added in version 22.1.0
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

added in version 22.1.0
int getPopulation ()

Returns
int the number of pixels represented by this swatch

getRgb

added in version 22.1.0
int getRgb ()

Returns
int this swatch's RGB color value

getTitleTextColor

added in version 22.1.0
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