Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

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

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

Float

The maximum lightness value for this target.

Float

The maximum saturation value for this target.

Float

The minimum lightness value for this target.

Float

The minimum saturation value for this target.

Float

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

Float

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

Float

The target lightness value for this target.

Float

The target saturation value for this target.

Boolean

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

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

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.

getMaximumLightness

fun getMaximumLightness(): Float

The maximum lightness value for this target.

getMaximumSaturation

fun getMaximumSaturation(): Float

The maximum saturation value for this target.

getMinimumLightness

fun getMinimumLightness(): Float

The minimum lightness value for this target.

getMinimumSaturation

fun getMinimumSaturation(): Float

The minimum saturation 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.

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.

getTargetLightness

fun getTargetLightness(): Float

The target lightness value for this target.

getTargetSaturation

fun getTargetSaturation(): Float

The target saturation value for this target.

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.

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.