public final class

Palette.Swatch

extends java.lang.Object

 java.lang.Object

↳androidx.palette.graphics.Palette.Swatch

Overview

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

Summary

Constructors
publicSwatch(int color, int population)

Methods
public booleanequals(java.lang.Object o)

public intgetBodyTextColor()

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

public float[]getHsl()

Return this swatch's HSL values.

public intgetPopulation()

public intgetRgb()

public intgetTitleTextColor()

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

public inthashCode()

public java.lang.StringtoString()

from java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructors

public Swatch(int color, int population)

Methods

public int getRgb()

Returns:

this swatch's RGB color value

public 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]

public int getPopulation()

Returns:

the number of pixels represented by this swatch

public 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.

public 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.

public java.lang.String toString()

public boolean equals(java.lang.Object o)

public int hashCode()