# Color.Companion

Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/Color.kt+class:androidx.compose.ui.graphics.Color.Companion) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  object Color.Companion
  ```

*** ** * ** ***

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)( hue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, saturation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, lightness: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, alpha: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, colorSpace: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb )` Return a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)` (HSL representation). | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)(hue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, saturation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, alpha: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, colorSpace: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb)` Return a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)` (HSV representation). | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Black()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Blue()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Cyan()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#DarkGray()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Gray()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Green()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#LightGray()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Magenta()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Red()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Transparent()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Unspecified()` Because Color is an inline class, this represents an unset value without having to box the Color. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#White()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Yellow()` | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion.https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#(androidx.compose.ui.graphics.Color.Companion).fromColorLong(kotlin.Long)(colorLong: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Creates a Color from an Android 64-bit color value. | android |

| ### Extension properties |
|---|---|---|
| `(colorSpace: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace) -> https://developer.android.com/reference/kotlin/androidx/compose/animation/core/TwoWayConverter<https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color, https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector4D>` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion.https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#(androidx.compose.ui.graphics.Color.Companion).VectorConverter()` A lambda that takes a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace` and returns a converter that can both convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` to a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector4D`, and convert a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector4D`) back to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` in the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace`. | Cmn |

## Public functions

### hsl

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun hsl(
    hue: Float,
    saturation: Float,
    lightness: Float,
    alpha: Float = 1.0f,
    colorSpace: Rgb = ColorSpaces.Srgb
): Color
```

Return a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)` (HSL representation).

| Parameters |
|---|---|
| `hue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The color value in the range (0..360), where 0 is red, 120 is green, and 240 is blue |
| `saturation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The amount of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsl(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)` represented in the color in the range (0..1), where 0 has no color and 1 is fully saturated. |
| `lightness: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | A range of (0..1) where 0 is black, 0.5 is fully colored, and 1 is white. |
| `alpha: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 1.0f` | Alpha channel to apply to the computed color |
| `colorSpace: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb = ColorSpaces.Srgb` | The RGB color space used to calculate the Color from the HSL values. |

### hsv

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
fun hsv(
    hue: Float,
    saturation: Float,
    value: Float,
    alpha: Float = 1.0f,
    colorSpace: Rgb = ColorSpaces.Srgb
): Color
```

Return a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` from `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)`, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)` (HSV representation).

| Parameters |
|---|---|
| `hue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The color value in the range (0..360), where 0 is red, 120 is green, and 240 is blue |
| `saturation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The amount of `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color.Companion#hsv(kotlin.Float,kotlin.Float,kotlin.Float,kotlin.Float,androidx.compose.ui.graphics.colorspace.Rgb)` represented in the color in the range (0..1), where 0 has no color and 1 is fully saturated. |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The strength of the color, where 0 is black. |
| `alpha: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = 1.0f` | Alpha channel to apply to the computed color |
| `colorSpace: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/Rgb = ColorSpaces.Srgb` | The RGB color space used to calculate the Color from the HSV values. |

## Public properties

### Black

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Black: Color
```

### Blue

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Blue: Color
```

### Cyan

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Cyan: Color
```

### DarkGray

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val DarkGray: Color
```

### Gray

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Gray: Color
```

### Green

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Green: Color
```

### LightGray

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val LightGray: Color
```

### Magenta

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Magenta: Color
```

### Red

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Red: Color
```

### Transparent

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Transparent: Color
```

### Unspecified

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Unspecified: Color
```

Because Color is an inline class, this represents an unset value without having to box the Color. It will be treated as `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Transparent()` when drawn. A Color can compare with `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Unspecified()` for equality or use `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/package-summary#(androidx.compose.ui.graphics.Color).isUnspecified()` to check for the unset value or `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/package-summary#(androidx.compose.ui.graphics.Color).isSpecified()` for any color that isn't `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#Unspecified()`.

### White

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val White: Color
```

### Yellow

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0)

```
val Yellow: Color
```

## Extension functions

### Color.Companion.fromColorLong

android Artifact: [androidx.compose.ui:ui-graphics](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/graphics/AndroidColor.android.kt+function:fromColorLong)

```
fun Color.Companion.fromColorLong(colorLong: @ColorLong Long): Color
```

Creates a Color from an Android 64-bit color value. This differs from the `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` constructor accepting a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` in that the constructor assumes the incoming value is a 32-bit ARGB color, while this is a 64-bit `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong` color from Android. `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color#value()` isn't fully compatible with Android's 64-bit `https://developer.android.com/reference/kotlin/androidx/annotation/ColorLong` values as some color spaces differ, so this method handles the conversion.

## Extension properties

### Color.Companion.VectorConverter

Cmn Artifact: [androidx.compose.animation:animation](https://developer.android.com/jetpack/androidx/releases/compose-animation) [View Source](https://cs.android.com/search?q=file:androidx/compose/animation/ColorVectorConverter.kt+symbol:VectorConverter) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-animation#1.0.0)

```
val Color.Companion.VectorConverter: (colorSpace: ColorSpace) -> TwoWayConverter<Color, AnimationVector4D>
```

A lambda that takes a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace` and returns a converter that can both convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` to a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector4D`, and convert a `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationVector4D`) back to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/Color` in the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace`.