# Target

Artifact: [androidx.palette:palette](https://developer.android.com/jetpack/androidx/releases/palette) [View Source](https://cs.android.com/search?q=file:androidx/palette/graphics/Target.java+class:androidx.palette.graphics.Target) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

*** ** * ** ***


```
class Target
```

<br />

*** ** * ** ***

A class which allows custom selection of colors in a `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Palette`'s generation. Instances can be created via the `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target.Builder` class.

To use the target, use the `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Palette.Builder#addTarget(androidx.palette.graphics.Target)` API when building a Palette.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target.Builder` Builder class for generating custom `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target` instances. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#DARK_MUTED()` A target which has the characteristics of a muted color which is dark in luminance. |
| `const https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#DARK_VIBRANT()` A target which has the characteristics of a vibrant color which is dark in luminance. |
| `const https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#LIGHT_MUTED()` A target which has the characteristics of a muted color which is light in luminance. |
| `const https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#LIGHT_VIBRANT()` A target which has the characteristics of a vibrant color which is light in luminance. |
| `const https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#MUTED()` A target which has the characteristics of a muted color which is neither light or dark. |
| `const https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#VIBRANT()` A target which has the characteristics of a vibrant color which is neither light or dark. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getLightnessWeight()()` Returns the weight of importance that this target places on a color's lightness within the image. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getMaximumLightness()()` The maximum lightness value for this target. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getMaximumSaturation()()` The maximum saturation value for this target. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getMinimumLightness()()` The minimum lightness value for this target. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getMinimumSaturation()()` The minimum saturation value for this target. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getPopulationWeight()()` Returns the weight of importance that this target places on a color's population within the image. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getSaturationWeight()()` Returns the weight of importance that this target places on a color's saturation within the image. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getTargetLightness()()` The target lightness value for this target. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0, to = 1) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getTargetSaturation()()` The target saturation value for this target. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#isExclusive()()` Returns whether any color selected for this target is exclusive for this target only. |

## Constants

### DARK_MUTED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
const val DARK_MUTED: Target
```

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

### DARK_VIBRANT

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
const val DARK_VIBRANT: Target
```

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

### LIGHT_MUTED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
const val LIGHT_MUTED: Target
```

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

### LIGHT_VIBRANT

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
const val LIGHT_VIBRANT: Target
```

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

### MUTED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
const val MUTED: Target
```

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

### VIBRANT

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
const val VIBRANT: Target
```

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

## Public functions

### getLightnessWeight

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
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.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getTargetLightness()` |   |

### getMaximumLightness

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
fun getMaximumLightness(): @FloatRange(from = 0, to = 1) Float
```

The maximum lightness value for this target.

### getMaximumSaturation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
fun getMaximumSaturation(): @FloatRange(from = 0, to = 1) Float
```

The maximum saturation value for this target.

### getMinimumLightness

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
fun getMinimumLightness(): @FloatRange(from = 0, to = 1) Float
```

The minimum lightness value for this target.

### getMinimumSaturation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
fun getMinimumSaturation(): @FloatRange(from = 0, to = 1) Float
```

The minimum saturation value for this target.

### getPopulationWeight

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
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

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
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.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/palette/graphics/Target#getTargetSaturation()` |   |

### getTargetLightness

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
fun getTargetLightness(): @FloatRange(from = 0, to = 1) Float
```

The target lightness value for this target.

### getTargetSaturation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
fun getTargetSaturation(): @FloatRange(from = 0, to = 1) Float
```

The target saturation value for this target.

### isExclusive

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/palette#1.0.0)

```
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.