Stay organized with collections Save and categorize content based on your preferences.

Target

public final class 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 addTarget API when building a Palette.

Summary

Nested types

public final class Target.Builder

Builder class for generating custom Target instances.

Constants

static final Target

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

static final Target

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

static final Target

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

static final Target

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

static final Target

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

static final Target

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

Public methods

float

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

@FloatRange(from = 0, to = 1) float

The maximum lightness value for this target.

@FloatRange(from = 0, to = 1) float

The maximum saturation value for this target.

@FloatRange(from = 0, to = 1) float

The minimum lightness value for this target.

@FloatRange(from = 0, to = 1) 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.

@FloatRange(from = 0, to = 1) float

The target lightness value for this target.

@FloatRange(from = 0, to = 1) float

The target saturation value for this target.

boolean

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

Constants

DARK_MUTED

public static final Target DARK_MUTED

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

DARK_VIBRANT

public static final Target DARK_VIBRANT

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

LIGHT_MUTED

public static final Target LIGHT_MUTED

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

LIGHT_VIBRANT

public static final Target LIGHT_VIBRANT

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

MUTED

public static final Target MUTED

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

VIBRANT

public static final Target VIBRANT

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

Public methods

getLightnessWeight

public float getLightnessWeight()

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

public @FloatRange(from = 0, to = 1) float getMaximumLightness()

The maximum lightness value for this target.

getMaximumSaturation

public @FloatRange(from = 0, to = 1) float getMaximumSaturation()

The maximum saturation value for this target.

getMinimumLightness

public @FloatRange(from = 0, to = 1) float getMinimumLightness()

The minimum lightness value for this target.

getMinimumSaturation

public @FloatRange(from = 0, to = 1) float getMinimumSaturation()

The minimum saturation value for this target.

getPopulationWeight

public float getPopulationWeight()

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

public float getSaturationWeight()

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

public @FloatRange(from = 0, to = 1) float getTargetLightness()

The target lightness value for this target.

getTargetSaturation

public @FloatRange(from = 0, to = 1) float getTargetSaturation()

The target saturation value for this target.

isExclusive

public boolean isExclusive()

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.