# ColorKt

Added in 1.1.0

*** ** * ** ***


```
public final class ColorKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(android.graphics.Color).component1()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html receiver)` Returns the first component of the color. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).component1()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the alpha component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).component1()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Returns the first component of the color. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(android.graphics.Color).component2()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html receiver)` Returns the second component of the color. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).component2()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the red component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).component2()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Returns the second component of the color. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(android.graphics.Color).component3()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html receiver)` Returns the third component of the color. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).component3()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the green component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).component3()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Returns the third component of the color. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(android.graphics.Color).component4()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html receiver)` Returns the fourth component of the color. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).component4()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the blue component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).component4()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Returns the fourth component of the color. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(android.graphics.Color).convertTo(android.graphics.ColorSpace)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/ColorSpace.html colorSpace)` Converts the color receiver to a color in the specified color space. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(android.graphics.Color).convertTo(android.graphics.ColorSpace.Named)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/ColorSpace.Named.html colorSpace)` Converts the color receiver to a color in the specified color space. |
| `static final @https://developer.android.com/reference/androidx/annotation/ColorLong long` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).convertTo(android.graphics.ColorSpace)(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/ColorSpace.html colorSpace)` Converts the color int receiver to a color long in the specified color space. |
| `static final @https://developer.android.com/reference/androidx/annotation/ColorLong long` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).convertTo(android.graphics.ColorSpace.Named)(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/ColorSpace.Named.html colorSpace)` Converts the color int receiver to a color long in the specified color space. |
| `static final @https://developer.android.com/reference/androidx/annotation/ColorLong long` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).convertTo(android.graphics.ColorSpace)(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/ColorSpace.html colorSpace)` Converts the color long receiver to a color long in the specified color space. |
| `static final @https://developer.android.com/reference/androidx/annotation/ColorLong long` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).convertTo(android.graphics.ColorSpace.Named)(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/ColorSpace.Named.html colorSpace)` Converts the color long receiver to a color long in the specified color space. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).getAlpha()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the alpha component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).getAlpha()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Return the alpha component of a color long. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).getBlue()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the blue component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).getBlue()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Return the blue component of a color long. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/ColorSpace.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).getColorSpace()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Returns the color space encoded in the specified color long. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).getGreen()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the green component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).getGreen()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Return the green component of a color long. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).getLuminance()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Returns the relative luminance of a color int, assuming sRGB encoding. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).getLuminance()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Returns the relative luminance of a color. |
| `static final int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).getRed()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Return the red component of a color int. |
| `static final float` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).getRed()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Return the red component of a color long. |
| `static final boolean` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).isSrgb()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Indicates whether the color is in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named.html#SRGB` color space. |
| `static final boolean` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).isWideGamut()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Indicates whether the color is in a `https://developer.android.com/reference/android/graphics/ColorSpace.html` color space. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(android.graphics.Color).plus(android.graphics.Color)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html c)` Composites two translucent colors together. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).toColor()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Creates a new `https://developer.android.com/reference/android/graphics/Color.html` instance from a color int. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Color.html` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).toColor()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Creates a new `https://developer.android.com/reference/android/graphics/Color.html` instance from a `https://developer.android.com/reference/android/graphics/Color.html`. |
| `static final @https://developer.android.com/reference/androidx/annotation/ColorInt int` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Long).toColorInt()(@https://developer.android.com/reference/androidx/annotation/ColorLong long receiver)` Converts the specified `https://developer.android.com/reference/android/graphics/Color.html` to an ARGB `https://developer.android.com/reference/android/graphics/Color.html`. |
| `static final @https://developer.android.com/reference/androidx/annotation/ColorInt int` | `https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.String).toColorInt()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html receiver)` Return a corresponding `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` color of this `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html`. |
| `static final @https://developer.android.com/reference/androidx/annotation/ColorLong long` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/androidx/core/graphics/ColorKt#(kotlin.Int).toColorLong()(@https://developer.android.com/reference/androidx/annotation/ColorInt int receiver)` Converts the specified ARGB `https://developer.android.com/reference/android/graphics/Color.html` to an RGBA `https://developer.android.com/reference/android/graphics/Color.html` in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named.html#SRGB` color space. |

## Public methods

### component1

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component1) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component1(@NonNull Color receiver)
```

Returns the first component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the first component is "red".

This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue) = myColor
```

### component1

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component1) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int component1(@ColorInt int receiver)
```

Return the alpha component of a color int. This is equivalent to calling:

```
Color.alpha(myInt)
```

This method allows to use destructuring declarations when working with colors, for example:

```
val (alpha, red, green, blue) = myColor
```

### component1

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component1) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component1(@ColorLong long receiver)
```

Returns the first component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the first component is "red".

This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue, alpha) = myColorLong
```

### component2

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component2) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component2(@NonNull Color receiver)
```

Returns the second component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the second component is "green".

This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue) = myColor
```

### component2

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component2) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int component2(@ColorInt int receiver)
```

Return the red component of a color int. This is equivalent to calling:

```
Color.red(myInt)
```

This method allows to use destructuring declarations when working with colors, for example:

```
val (alpha, red, green, blue) = myColor
```

### component2

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component2) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component2(@ColorLong long receiver)
```

Returns the second component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the second component is "green".

This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue, alpha) = myColorLong
```

### component3

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component3) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component3(@NonNull Color receiver)
```

Returns the third component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the third component is "blue". = \* This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue) = myColor
```

### component3

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component3) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int component3(@ColorInt int receiver)
```

Return the green component of a color int. This is equivalent to calling:

```
Color.green(myInt)
```

This method allows to use destructuring declarations when working with colors, for example:

```
val (alpha, red, green, blue) = myColor
```

### component3

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component3) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component3(@ColorLong long receiver)
```

Returns the third component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the third component is "blue".

This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue, alpha) = myColorLong
```

### component4

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component4) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component4(@NonNull Color receiver)
```

Returns the fourth component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the fourth component is "alpha".

This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue, alpha) = myColor
```

### component4

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component4) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int component4(@ColorInt int receiver)
```

Return the blue component of a color int. This is equivalent to calling:

```
Color.blue(myInt)
```

This method allows to use destructuring declarations when working with colors, for example:

```
val (alpha, red, green, blue) = myColor
```

### component4

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:component4) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float component4(@ColorLong long receiver)
```

Returns the fourth component of the color. For instance, when the color model of the color is `https://developer.android.com/reference/android/graphics/ColorSpace.Model.html#RGB`, the fourth component is "alpha".

This method allows to use destructuring declarations when working with colors, for example:

```
val (red, green, blue, alpha) = myColorLong
```

### convertTo

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:convertTo) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @NonNull Color convertTo(@NonNull Color receiver, @NonNull ColorSpace colorSpace)
```

Converts the color receiver to a color in the specified color space. This is equivalent to calling:

```
myColor.convert(colorSpace)
```

### convertTo

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:convertTo) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @NonNull Color convertTo(@NonNull Color receiver, @NonNull ColorSpace.Named colorSpace)
```

Converts the color receiver to a color in the specified color space. This is equivalent to calling:

```
myColor.convert(ColorSpace.get(colorSpace))
```

### convertTo

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:convertTo) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @ColorLong long convertTo(@ColorInt int receiver, @NonNull ColorSpace colorSpace)
```

Converts the color int receiver to a color long in the specified color space. This is equivalent to calling:

```
Color.convert(myColorInt, colorSpace)
```

### convertTo

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:convertTo) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @ColorLong long convertTo(@ColorInt int receiver, @NonNull ColorSpace.Named colorSpace)
```

Converts the color int receiver to a color long in the specified color space. This is equivalent to calling:

```
Color.convert(myColorInt, ColorSpace.get(colorSpace))
```

### convertTo

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:convertTo) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @ColorLong long convertTo(@ColorLong long receiver, @NonNull ColorSpace colorSpace)
```

Converts the color long receiver to a color long in the specified color space. This is equivalent to calling:

```
Color.convert(myColorLong, colorSpace)
```

### convertTo

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:convertTo) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @ColorLong long convertTo(@ColorLong long receiver, @NonNull ColorSpace.Named colorSpace)
```

Converts the color long receiver to a color long in the specified color space. This is equivalent to calling:

```
Color.convert(myColorLong, ColorSpace.get(colorSpace))
```

### getAlpha

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:alpha) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int getAlpha(@ColorInt int receiver)
```

Return the alpha component of a color int. This is equivalent to calling:

```
Color.alpha(myInt)
```

### getAlpha

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:alpha) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float getAlpha(@ColorLong long receiver)
```

Return the alpha component of a color long. This is equivalent to calling:

```
Color.alpha(myLong)
```

### getBlue

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:blue) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int getBlue(@ColorInt int receiver)
```

Return the blue component of a color int. This is equivalent to calling:

```
Color.blue(myInt)
```

### getBlue

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:blue) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float getBlue(@ColorLong long receiver)
```

Return the blue component of a color long. This is equivalent to calling:

```
Color.blue(myLong)
```

### getColorSpace

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:colorSpace) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @NonNull ColorSpace getColorSpace(@ColorLong long receiver)
```

Returns the color space encoded in the specified color long.

### getGreen

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:green) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int getGreen(@ColorInt int receiver)
```

Return the green component of a color int. This is equivalent to calling:

```
Color.green(myInt)
```

### getGreen

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:green) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float getGreen(@ColorLong long receiver)
```

Return the green component of a color long. This is equivalent to calling:

```
Color.green(myLong)
```

### getLuminance

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:luminance) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float getLuminance(@ColorInt int receiver)
```

Returns the relative luminance of a color int, assuming sRGB encoding. Based on the formula for relative luminance defined in WCAG 2.0, W3C Recommendation 11 December 2008.

### getLuminance

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:luminance) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float getLuminance(@ColorLong long receiver)
```

Returns the relative luminance of a color. Based on the formula for relative luminance defined in WCAG 2.0, W3C Recommendation 11 December 2008.

### getRed

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:red) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final int getRed(@ColorInt int receiver)
```

Return the red component of a color int. This is equivalent to calling:

```
Color.red(myInt)
```

### getRed

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:red) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final float getRed(@ColorLong long receiver)
```

Return the red component of a color long. This is equivalent to calling:

```
Color.red(myLong)
```

### isSrgb

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:isSrgb) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final boolean isSrgb(@ColorLong long receiver)
```

Indicates whether the color is in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named.html#SRGB` color space.

### isWideGamut

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+symbol:isWideGamut) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final boolean isWideGamut(@ColorLong long receiver)
```

Indicates whether the color is in a `https://developer.android.com/reference/android/graphics/ColorSpace.html` color space.

### plus

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:plus) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @NonNull Color plus(@NonNull Color receiver, @NonNull Color c)
```

Composites two translucent colors together. More specifically, adds two colors using the `https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html#SRC_OVER` blending mode. The colors must not be pre-multiplied and the result is a non pre-multiplied color.

If the two colors have different color spaces, the color in the right-hand part of the expression is converted to the color space of the color in left-hand part of the expression.

The following example creates a purple color by blending opaque blue with semi-translucent red:

```
val purple = Color.valueOf(0f, 0f, 1f) + Color.valueOf(1f, 0f, 0f, 0.5f)
```

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the `https://developer.android.com/reference/android/graphics/Color.html#getModel()` of the colors do not match |

### toColor

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:toColor) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @NonNull Color toColor(@ColorInt int receiver)
```

Creates a new `https://developer.android.com/reference/android/graphics/Color.html` instance from a color int. The resulting color is in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named.html#SRGB` color space.

### toColor

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:toColor) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @NonNull Color toColor(@ColorLong long receiver)
```

Creates a new `https://developer.android.com/reference/android/graphics/Color.html` instance from a `https://developer.android.com/reference/android/graphics/Color.html`.

### toColorInt

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:toColorInt) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @ColorInt int toColorInt(@ColorLong long receiver)
```

Converts the specified `https://developer.android.com/reference/android/graphics/Color.html` to an ARGB `https://developer.android.com/reference/android/graphics/Color.html`.

### toColorInt

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:toColorInt) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @ColorInt int toColorInt(@NonNull String receiver)
```

Return a corresponding `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` color of this `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html`.

Supported formats are:

```
#RRGGBB
#AARRGGBB
```

The following names are also accepted: "red", "blue", "green", "black", "white", "gray", "cyan", "magenta", "yellow", "lightgray", "darkgray", "grey", "lightgrey", "darkgrey", "aqua", "fuchsia", "lime", "maroon", "navy", "olive", "purple", "silver", "teal".

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if this `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` cannot be parsed. |

### toColorLong

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/Color.kt+function:toColorLong) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
@RequiresApi(value = 26)
public static final @ColorLong long toColorLong(@ColorInt int receiver)
```

Converts the specified ARGB `https://developer.android.com/reference/android/graphics/Color.html` to an RGBA `https://developer.android.com/reference/android/graphics/Color.html` in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named.html#SRGB` color space.