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 | |
|---|---|
| Public methods | |
|---|---|
| Boolean | |
| Int |
Returns an appropriate color to use for any 'body' text which is displayed over this |
| FloatArray |
getHsl()Return this swatch's HSL values. |
| Int | |
| Int |
getRgb() |
| Int |
Returns an appropriate color to use for any 'title' text which is displayed over this |
| Int |
hashCode() |
| String |
toString() |
Public constructors
Public methods
getBodyTextColor
@ColorInt 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]
getTitleTextColor
@ColorInt 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

