Target

class Target
kotlin.Any
   ↳ androidx.palette.graphics.Target

A class which allows custom selection of colors in a Palette's generation. Instances can be created via the Builder class.

To use the target, use the Palette.Builder#addTarget(Target) API when building a Palette.

Summary

Nested classes

Builder class for generating custom Target instances.

Public methods
Float

The maximum saturation value for this target.

Float

The target lightness value for this target.

Float

The minimum lightness value for this target.

Float

Returns the weight of importance that this target places on a color's population within the image.

Float

The maximum lightness value for this target.

Float

Returns the weight of importance that this target places on a color's saturation within the image.

Boolean

Returns whether any color selected for this target is exclusive for this target only.

Float

Returns the weight of importance that this target places on a color's lightness within the image.

Float

The minimum saturation value for this target.

Float

The target saturation value for this target.

Properties
static Target!

A target which has the characteristics of a muted color which is dark in luminance.

static Target!

A target which has the characteristics of a vibrant color which is dark in luminance.

static Target!

A target which has the characteristics of a muted color which is light in luminance.

static Target!

A target which has the characteristics of a vibrant color which is light in luminance.

static Target!

A target which has the characteristics of a muted color which is neither light or dark.

static Target!

A target which has the characteristics of a vibrant color which is neither light or dark.

Public methods

getMaximumSaturation

fun getMaximumSaturation(): Float

The maximum saturation value for this target.

getTargetLightness

fun getTargetLightness(): Float

The target lightness value for this target.

getMinimumLightness

fun getMinimumLightness(): Float

The minimum lightness value for this target.

getPopulationWeight

fun getPopulationWeight(): Float

Returns the weight of importance that this target places on a color's population within the image.

The larger the weight, relative to the other weights, the more important that a color's population being close to the most populous has on selection.

getMaximumLightness

fun getMaximumLightness(): Float

The maximum lightness value for this target.

getSaturationWeight

fun getSaturationWeight(): Float

Returns the weight of importance that this target places on a color's saturation within the image.

The larger the weight, relative to the other weights, the more important that a color being close to the target value has on selection.

isExclusive

fun isExclusive(): Boolean

Returns whether any color selected for this target is exclusive for this target only.

If false, then the color can be selected for other targets.

getLightnessWeight

fun getLightnessWeight(): Float

Returns the weight of importance that this target places on a color's lightness within the image.

The larger the weight, relative to the other weights, the more important that a color being close to the target value has on selection.

getMinimumSaturation

fun getMinimumSaturation(): Float

The minimum saturation value for this target.

getTargetSaturation

fun getTargetSaturation(): Float

The target saturation value for this target.

Properties

DARK_MUTED

static val DARK_MUTED: Target!

A target which has the characteristics of a muted color which is dark in luminance.

DARK_VIBRANT

static val DARK_VIBRANT: Target!

A target which has the characteristics of a vibrant color which is dark in luminance.

LIGHT_MUTED

static val LIGHT_MUTED: Target!

A target which has the characteristics of a muted color which is light in luminance.

LIGHT_VIBRANT

static val LIGHT_VIBRANT: Target!

A target which has the characteristics of a vibrant color which is light in luminance.

MUTED

static val MUTED: Target!

A target which has the characteristics of a muted color which is neither light or dark.

VIBRANT

static val VIBRANT: Target!

A target which has the characteristics of a vibrant color which is neither light or dark.