added in
version 22.1.0
belongs to Maven artifact com.android.support:palette-v7:28.0.0-alpha1
Palette.Swatch
This package is part of the
Android support library which
is no longer maintained.
The support library has been superseded by AndroidX
which is part of Jetpack .
We recommend using the AndroidX libraries in all new projects. You should also consider
migrating existing projects to AndroidX.
To find the AndroidX class that maps to this deprecated class, see the AndroidX
support library class
mappings .
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
Inherited methods
From
class
java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
final
Class<?>
getClass()
int
hashCode()
final
void
notify()
final
void
notifyAll()
String
toString()
final
void
wait(long arg0, int arg1)
final
void
wait(long arg0)
final
void
wait()
Public constructors
Palette.Swatch
Palette.Swatch (int color,
int population)
Parameters
color
int
population
int
Public methods
equals
boolean equals (Object o)
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.
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]
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.
toString
String toString ()
Content and code samples on this page are subject to the licenses described in the Content License . Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[]]