Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/graphics/Color#constants) \| [Ctors](https://developer.android.com/reference/android/graphics/Color#pubctors) \| [Methods](https://developer.android.com/reference/android/graphics/Color#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/Color#inhmethods)

# Color

*** ** * ** ***


`
public


class
Color
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.Color |

<br />

*** ** * ** ***


The `Color` class provides methods for creating, converting and
manipulating colors. Colors have three different representations:

- Color ints, the most common representation
- Color longs
- `Color` instances

The section below describe each representation in detail.

### Color ints

Color ints are the most common representation of colors on Android and
have been used since `https://developer.android.com/reference/android/os/Build.VERSION_CODES#BASE`.

A color int always defines a color in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB`
color space using 4 components packed in a single 32 bit integer value:

| Component | Name | Size | Range |
|---|---|---|---|
| A | Alpha | 8 bits | \\(\[0..255\]\\) |
| R | Red | 8 bits | \\(\[0..255\]\\) |
| G | Green | 8 bits | \\(\[0..255\]\\) |
| B | Blue | 8 bits | \\(\[0..255\]\\) |

The components in this table are listed in encoding order (see below),
which is why color ints are called ARGB colors.

#### Usage in code

To avoid confusing color ints with arbitrary integer values, it is a
good practice to annotate them with the `@ColorInt` annotation
found in the Android Support Library.

#### Encoding

The four components of a color int are encoded in the following way:

```
int color = (A & 0xff) << 24 | (R & 0xff) << 16 | (G & 0xff) << 8 | (B & 0xff);
```

Because of this encoding, color ints can easily be described as an integer
constant in source. For instance, opaque blue is `0xff0000ff`
and yellow is `0xffffff00`.

To easily encode color ints, it is recommended to use the static methods
`https://developer.android.com/reference/android/graphics/Color#argb(int,%20int,%20int,%20int)` and `https://developer.android.com/reference/android/graphics/Color#rgb(int,%20int,%20int)`. The second
method omits the alpha component and assumes the color is opaque (alpha is 255).
As a convenience this class also offers methods to encode color ints from components
defined in the \\(\[0..1\]\\) range: `https://developer.android.com/reference/android/graphics/Color#argb(float,%20float,%20float,%20float)` and
`https://developer.android.com/reference/android/graphics/Color#rgb(float,%20float,%20float)`.

Color longs (defined below) can be easily converted to color ints by invoking
the `https://developer.android.com/reference/android/graphics/Color#toArgb(long)` method. This method performs a color space conversion
if needed.

It is also possible to create a color int by invoking the method `https://developer.android.com/reference/android/graphics/Color#toArgb()`
on a color instance.

#### Decoding

The four ARGB components can be individually extracted from a color int
using the following expressions:

```
int A = (color >> 24) & 0xff; // or color >>> 24
int R = (color >> 16) & 0xff;
int G = (color >>  8) & 0xff;
int B = (color      ) & 0xff;
```

This class offers convenience methods to easily extract these components:

- `https://developer.android.com/reference/android/graphics/Color#alpha(int)` to extract the alpha component
- `https://developer.android.com/reference/android/graphics/Color#red(int)` to extract the red component
- `https://developer.android.com/reference/android/graphics/Color#green(int)` to extract the green component
- `https://developer.android.com/reference/android/graphics/Color#blue(int)` to extract the blue component

### Color longs

Color longs are a representation introduced in
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#O` to store colors in different
`https://developer.android.com/reference/android/graphics/ColorSpace`, with more precision than color ints.

A color long always defines a color using 4 components packed in a single
64 bit long value. One of these components is always alpha while the other
three components depend on the color space's `https://developer.android.com/reference/android/graphics/ColorSpace.Model`.
The most common color model is the `https://developer.android.com/reference/android/graphics/ColorSpace.Model#RGB` model in
which the components represent red, green and blue values.

**Component ranges:** the ranges defined in the tables
below indicate the ranges that can be encoded in a color long. They do not
represent the actual ranges as they may differ per color space. For instance,
the RGB components of a color in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#DISPLAY_P3`
color space use the \\(\[0..1\]\\) range. Please refer to the documentation of the
various `https://developer.android.com/reference/android/graphics/ColorSpace.Named` to find their respective ranges.

**Alpha range:** while alpha is encoded in a color long using
a 10 bit integer (thus using a range of \\(\[0..1023\]\\)), it is converted to and
from \\(\[0..1\]\\) float values when decoding and encoding color longs.

**sRGB color space:** for compatibility reasons and ease of
use, color longs encoding `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` colors do not
use the same encoding as other color longs.

| Component | Name | Size | Range |
|---|---|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace.Model#RGB` color model ||||
| R | Red | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| G | Green | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| B | Blue | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| A | Alpha | 10 bits | \\(\[0..1023\]\\) |
|   | Color space | 6 bits | \\(\[0..63\]\\) |
| `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space ||||
| A | Alpha | 8 bits | \\(\[0..255\]\\) |
| R | Red | 8 bits | \\(\[0..255\]\\) |
| G | Green | 8 bits | \\(\[0..255\]\\) |
| B | Blue | 8 bits | \\(\[0..255\]\\) |
| X | Unused | 32 bits | \\(0\\) |
| `https://developer.android.com/reference/android/graphics/ColorSpace.Model#XYZ` color model ||||
| X | X | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| Y | Y | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| Z | Z | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| A | Alpha | 10 bits | \\(\[0..1023\]\\) |
|   | Color space | 6 bits | \\(\[0..63\]\\) |
| `https://developer.android.com/reference/android/graphics/ColorSpace.Model#XYZ` color model ||||
| L | L | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| a | a | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| b | b | 16 bits | \\(\[-65504.0, 65504.0\]\\) |
| A | Alpha | 10 bits | \\(\[0..1023\]\\) |
|   | Color space | 6 bits | \\(\[0..63\]\\) |
| `https://developer.android.com/reference/android/graphics/ColorSpace.Model#CMYK` color model ||||
| Unsupported ||||

The components in this table are listed in encoding order (see below),
which is why color longs in the RGB model are called RGBA colors (even if
this doesn't quite hold for the special case of sRGB colors).

The color long encoding relies on half-precision float values (fp16). If you
wish to know more about the limitations of half-precision float values, please
refer to the documentation of the `https://developer.android.com/reference/android/util/Half` class.

#### Usage in code

To avoid confusing color longs with arbitrary long values, it is a
good practice to annotate them with the `@ColorLong` annotation
found in the Android Support Library.

#### Encoding

Given the complex nature of color longs, it is strongly encouraged to use
the various methods provided by this class to encode them.

The most flexible way to encode a color long is to use the method
`https://developer.android.com/reference/android/graphics/Color#pack(float,%20float,%20float,%20float,%20android.graphics.ColorSpace)`. This method allows you
to specify three color components (typically RGB), an alpha component and a
color space. To encode sRGB colors, use `https://developer.android.com/reference/android/graphics/Color#pack(float,%20float,%20float)`
and `https://developer.android.com/reference/android/graphics/Color#pack(float,%20float,%20float,%20float)` which are the
equivalent of `https://developer.android.com/reference/android/graphics/Color#rgb(int,%20int,%20int)` and `https://developer.android.com/reference/android/graphics/Color#argb(int,%20int,%20int,%20int)`
for color ints. If you simply need to convert a color int into a color long,
use `https://developer.android.com/reference/android/graphics/Color#pack(int)`.

It is also possible to create a color long value by invoking the method
`https://developer.android.com/reference/android/graphics/Color#pack()` on a color instance.

#### Decoding

This class offers convenience methods to easily extract the components
of a color long:

- `https://developer.android.com/reference/android/graphics/Color#alpha(long)` to extract the alpha component
- `https://developer.android.com/reference/android/graphics/Color#red(long)` to extract the red/X/L component
- `https://developer.android.com/reference/android/graphics/Color#green(long)` to extract the green/Y/a component
- `https://developer.android.com/reference/android/graphics/Color#blue(long)` to extract the blue/Z/b component

The values returned by these methods depend on the color space encoded
in the color long. The values are however typically in the \\(\[0..1\]\\) range
for RGB colors. Please refer to the documentation of the various
`https://developer.android.com/reference/android/graphics/ColorSpace.Named` for the exact ranges.

### Color instances

Color instances are a representation introduced in
`https://developer.android.com/reference/android/os/Build.VERSION_CODES#O` to store colors in different
`https://developer.android.com/reference/android/graphics/ColorSpace`, with more precision than both color ints and
color longs. Color instances also offer the ability to store more than 4
components if necessary.

Colors instances are immutable and can be created using one of the various
`valueOf` methods. For instance:

```
// sRGB
Color opaqueRed = Color.valueOf(0xffff0000); // from a color int
Color translucentRed = Color.valueOf(1.0f, 0.0f, 0.0f, 0.5f);

// Wide gamut color
@ColorLong long p3 = pack(1.0f, 1.0f, 0.0f, 1.0f, colorSpaceP3);
Color opaqueYellow = Color.valueOf(p3); // from a color long

// CIE L*a*b* color space
ColorSpace lab = ColorSpace.get(ColorSpace.Named.LAB);
Color green = Color.valueOf(100.0f, -128.0f, 128.0f, 1.0f, lab);
```

Color instances can be converted to color ints (`https://developer.android.com/reference/android/graphics/Color#toArgb()`) or
color longs (`https://developer.android.com/reference/android/graphics/Color#pack()`). They also offer easy access to their various
components using the following methods:

- `https://developer.android.com/reference/android/graphics/Color#alpha()`, returns the alpha component value
- `https://developer.android.com/reference/android/graphics/Color#red()`, returns the red component value (or first component value in non-RGB models)
- `https://developer.android.com/reference/android/graphics/Color#green()`, returns the green component value (or second component value in non-RGB models)
- `https://developer.android.com/reference/android/graphics/Color#blue()`, returns the blue component value (or third component value in non-RGB models)
- `https://developer.android.com/reference/android/graphics/Color#getComponent(int)`, returns a specific component value
- `https://developer.android.com/reference/android/graphics/Color#getComponents()`, returns all component values as an array

### Color space conversions

You can convert colors from one color space to another using
`https://developer.android.com/reference/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace)` and its variants. However,
the `Color` class provides a few convenience methods to simplify
the process. Here is a brief description of some of them:

- `https://developer.android.com/reference/android/graphics/Color#convert(android.graphics.ColorSpace)` to convert a color instance in a color space to a new color instance in a different color space
- `https://developer.android.com/reference/android/graphics/Color#convert(float,%20float,%20float,%20float,%20android.graphics.ColorSpace,%20android.graphics.ColorSpace)` to convert a color from a source color space to a destination color space
- `https://developer.android.com/reference/android/graphics/Color#convert(long,%20android.graphics.ColorSpace)` to convert a color long from its built-in color space to a destination color space
- `https://developer.android.com/reference/android/graphics/Color#convert(int,%20android.graphics.ColorSpace)` to convert a color int from sRGB to a destination color space

Please refere to the `https://developer.android.com/reference/android/graphics/ColorSpace` documentation for more
information.

### Alpha and transparency

The alpha component of a color defines the level of transparency of a
color. When the alpha component is 0, the color is completely transparent.
When the alpha is component is 1 (in the \\(\[0..1\]\\) range) or 255 (in the
\\(\[0..255\]\\) range), the color is completely opaque.

The color representations described above do not use pre-multiplied
color components (a pre-multiplied color component is a color component
that has been multiplied by the value of the alpha component).
For instance, the color int representation of opaque red is
`0xffff0000`. For semi-transparent (50%) red, the
representation becomes `0x80ff0000`. The equivalent color
instance representations would be `(1.0, 0.0, 0.0, 1.0)`
and `(1.0, 0.0, 0.0, 0.5)`.

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/graphics/Color#BLACK` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#BLUE` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#CYAN` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#DKGRAY` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#GRAY` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#GREEN` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#LTGRAY` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#MAGENTA` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#RED` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#TRANSPARENT` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#WHITE` |
| `int` | `https://developer.android.com/reference/android/graphics/Color#YELLOW` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/Color#Color()() ` Creates a new color instance set to opaque black in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space. |

| ### Public methods ||
|---|---|
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#HSVToColor(float[])(float[] hsv) ` Convert HSV components to an ARGB color. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#HSVToColor(int,%20float[])(int alpha, float[] hsv) ` Convert HSV components to an ARGB color. |
| ` static void` | ` https://developer.android.com/reference/android/graphics/Color#RGBToHSV(int,%20int,%20int,%20float[])(int red, int green, int blue, float[] hsv) ` Convert RGB components to HSV. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#alpha(int)(int color) ` Return the alpha component of a color int. |
| ` float` | ` https://developer.android.com/reference/android/graphics/Color#alpha()() ` Returns the value of the alpha component in the range \\(\[0..1\]\\). |
| ` static float` | ` https://developer.android.com/reference/android/graphics/Color#alpha(long)(long color) ` Returns the alpha component encoded in the specified color long. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#argb(int,%20int,%20int,%20int)(int alpha, int red, int green, int blue) ` Return a color-int from alpha, red, green, blue components. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#argb(float,%20float,%20float,%20float)(float alpha, float red, float green, float blue) ` Return a color-int from alpha, red, green, blue float components in the range \\(\[0..1\]\\). |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#blue(int)(int color) ` Return the blue component of a color int. |
| ` float` | ` https://developer.android.com/reference/android/graphics/Color#blue()() ` <br /> Returns the value of the blue component in the range defined by this color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and `https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`). |
| ` static float` | ` https://developer.android.com/reference/android/graphics/Color#blue(long)(long color) ` Returns the blue component encoded in the specified color long. |
| ` static https://developer.android.com/reference/android/graphics/ColorSpace` | ` https://developer.android.com/reference/android/graphics/Color#colorSpace(long)(long color) ` Returns the color space encoded in the specified color long. |
| ` static void` | ` https://developer.android.com/reference/android/graphics/Color#colorToHSV(int,%20float[])(int color, float[] hsv) ` Convert the ARGB color to its HSV components. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#convert(long,%20android.graphics.ColorSpace.Connector)(long color, https://developer.android.com/reference/android/graphics/ColorSpace.Connector connector) ` <br /> Converts the specified color long from a color space to another using the specified color space `https://developer.android.com/reference/android/graphics/ColorSpace.Connector`. |
| ` https://developer.android.com/reference/android/graphics/Color` | ` https://developer.android.com/reference/android/graphics/Color#convert(android.graphics.ColorSpace)(https://developer.android.com/reference/android/graphics/ColorSpace colorSpace) ` Converts this color from its color space to the specified color space. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#convert(int,%20android.graphics.ColorSpace)(int color, https://developer.android.com/reference/android/graphics/ColorSpace colorSpace) ` Converts the specified ARGB color int from the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space into the specified destination color space. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#convert(float,%20float,%20float,%20float,%20android.graphics.ColorSpace,%20android.graphics.ColorSpace)(float r, float g, float b, float a, https://developer.android.com/reference/android/graphics/ColorSpace source, https://developer.android.com/reference/android/graphics/ColorSpace destination) ` <br /> Converts the specified 3 component color from the source color space to the destination color space. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#convert(float,%20float,%20float,%20float,%20android.graphics.ColorSpace.Connector)(float r, float g, float b, float a, https://developer.android.com/reference/android/graphics/ColorSpace.Connector connector) ` <br /> Converts the specified 3 component color from a color space to another using the specified color space `https://developer.android.com/reference/android/graphics/ColorSpace.Connector`. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#convert(long,%20android.graphics.ColorSpace)(long color, https://developer.android.com/reference/android/graphics/ColorSpace colorSpace) ` <br /> Converts the specified color long from its color space into the specified destination color space. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Color#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Indicates whether some other object is "equal to" this one. |
| ` https://developer.android.com/reference/android/graphics/ColorSpace` | ` https://developer.android.com/reference/android/graphics/Color#getColorSpace()() ` Returns this color's color space. |
| ` float` | ` https://developer.android.com/reference/android/graphics/Color#getComponent(int)(int component) ` <br /> Returns the value of the specified component in the range defined by this color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and `https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`). |
| ` int` | ` https://developer.android.com/reference/android/graphics/Color#getComponentCount()() ` Returns the number of components that form a color value according to this color space's color model, plus one extra component for alpha. |
| ` float[]` | ` https://developer.android.com/reference/android/graphics/Color#getComponents()() ` Returns this color's components as a new array. |
| ` float[]` | ` https://developer.android.com/reference/android/graphics/Color#getComponents(float[])(float[] components) ` Copies this color's components in the supplied array. |
| ` https://developer.android.com/reference/android/graphics/ColorSpace.Model` | ` https://developer.android.com/reference/android/graphics/Color#getModel()() ` Returns the color model of this color. |
| ` static float` | ` https://developer.android.com/reference/android/graphics/Color#green(long)(long color) ` Returns the green component encoded in the specified color long. |
| ` float` | ` https://developer.android.com/reference/android/graphics/Color#green()() ` <br /> Returns the value of the green component in the range defined by this color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and `https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`). |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#green(int)(int color) ` Return the green component of a color int. |
| ` int` | ` https://developer.android.com/reference/android/graphics/Color#hashCode()() ` Returns a hash code value for the object. |
| ` static boolean` | ` https://developer.android.com/reference/android/graphics/Color#isInColorSpace(long,%20android.graphics.ColorSpace)(long color, https://developer.android.com/reference/android/graphics/ColorSpace colorSpace) ` Indicates whether the specified color is in the specified color space. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Color#isSrgb()() ` Indicates whether this color is in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space. |
| ` static boolean` | ` https://developer.android.com/reference/android/graphics/Color#isSrgb(long)(long color) ` Indicates whether the specified color is in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space. |
| ` static boolean` | ` https://developer.android.com/reference/android/graphics/Color#isWideGamut(long)(long color) ` Indicates whether the specified color is in a wide-gamut color space. |
| ` boolean` | ` https://developer.android.com/reference/android/graphics/Color#isWideGamut()() ` Indicates whether this color color is in a wide-gamut color space. |
| ` static float` | ` https://developer.android.com/reference/android/graphics/Color#luminance(long)(long color) ` <br /> Returns the relative luminance of a color. |
| ` static float` | ` https://developer.android.com/reference/android/graphics/Color#luminance(int)(int color) ` Returns the relative luminance of a color. |
| ` float` | ` https://developer.android.com/reference/android/graphics/Color#luminance()() ` <br /> Returns the relative luminance of this color. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#pack(int)(int color) ` Converts the specified ARGB color int to an RGBA color long in the sRGB color space. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#pack(float,%20float,%20float,%20float)(float red, float green, float blue, float alpha) ` Packs the sRGB color defined by the specified red, green, blue and alpha component values into an RGBA color long in the sRGB color space. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#pack(float,%20float,%20float,%20float,%20android.graphics.ColorSpace)(float red, float green, float blue, float alpha, https://developer.android.com/reference/android/graphics/ColorSpace colorSpace) ` <br /> Packs the 3 component color defined by the specified red, green, blue and alpha component values into a color long in the specified color space. |
| ` static long` | ` https://developer.android.com/reference/android/graphics/Color#pack(float,%20float,%20float)(float red, float green, float blue) ` Packs the sRGB color defined by the specified red, green and blue component values into an RGBA color long in the sRGB color space. |
| ` long` | ` https://developer.android.com/reference/android/graphics/Color#pack()() ` Packs this color into a color long. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#parseColor(java.lang.String)(https://developer.android.com/reference/java/lang/String colorString) ` <br /> Parse the color string, and return the corresponding color-int. <br /> |
| ` float` | ` https://developer.android.com/reference/android/graphics/Color#red()() ` <br /> Returns the value of the red component in the range defined by this color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and `https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`). |
| ` static float` | ` https://developer.android.com/reference/android/graphics/Color#red(long)(long color) ` Returns the red component encoded in the specified color long. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#red(int)(int color) ` Return the red component of a color int. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#rgb(float,%20float,%20float)(float red, float green, float blue) ` Return a color-int from red, green, blue float components in the range \\(\[0..1\]\\). |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#rgb(int,%20int,%20int)(int red, int green, int blue) ` Return a color-int from red, green, blue components. |
| ` int` | ` https://developer.android.com/reference/android/graphics/Color#toArgb()() ` Converts this color to an ARGB color int. |
| ` static int` | ` https://developer.android.com/reference/android/graphics/Color#toArgb(long)(long color) ` Converts the specified color long to an ARGB color int. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/graphics/Color#toString()() ` <br /> Returns a string representation of the object. |
| ` static https://developer.android.com/reference/android/graphics/Color` | ` https://developer.android.com/reference/android/graphics/Color#valueOf(float,%20float,%20float)(float r, float g, float b) ` Creates a new opaque `Color` in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space with the specified red, green and blue component values. |
| ` static https://developer.android.com/reference/android/graphics/Color` | ` https://developer.android.com/reference/android/graphics/Color#valueOf(float,%20float,%20float,%20float)(float r, float g, float b, float a) ` Creates a new `Color` in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space with the specified red, green, blue and alpha component values. |
| ` static https://developer.android.com/reference/android/graphics/Color` | ` https://developer.android.com/reference/android/graphics/Color#valueOf(int)(int color) ` Creates a new `Color` instance from an ARGB color int. |
| ` static https://developer.android.com/reference/android/graphics/Color` | ` https://developer.android.com/reference/android/graphics/Color#valueOf(float[],%20android.graphics.ColorSpace)(float[] components, https://developer.android.com/reference/android/graphics/ColorSpace colorSpace) ` <br /> Creates a new `Color` in the specified color space with the specified component values. |
| ` static https://developer.android.com/reference/android/graphics/Color` | ` https://developer.android.com/reference/android/graphics/Color#valueOf(long)(long color) ` Creates a new `Color` instance from a color long. |
| ` static https://developer.android.com/reference/android/graphics/Color` | ` https://developer.android.com/reference/android/graphics/Color#valueOf(float,%20float,%20float,%20float,%20android.graphics.ColorSpace)(float r, float g, float b, float a, https://developer.android.com/reference/android/graphics/ColorSpace colorSpace) ` Creates a new `Color` in the specified color space with the specified red, green, blue and alpha component values. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### BLACK

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BLACK
```

<br />

<br />

Constant Value:

-16777216
(0xff000000)


### BLUE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int BLUE
```

<br />

<br />

Constant Value:

-16776961
(0xff0000ff)


### CYAN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int CYAN
```

<br />

<br />

Constant Value:

-16711681
(0xff00ffff)


### DKGRAY

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int DKGRAY
```

<br />

<br />

Constant Value:

-12303292
(0xff444444)


### GRAY

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GRAY
```

<br />

<br />

Constant Value:

-7829368
(0xff888888)


### GREEN

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int GREEN
```

<br />

<br />

Constant Value:

-16711936
(0xff00ff00)


### LTGRAY

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int LTGRAY
```

<br />

<br />

Constant Value:

-3355444
(0xffcccccc)


### MAGENTA

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int MAGENTA
```

<br />

<br />

Constant Value:

-65281
(0xffff00ff)


### RED

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int RED
```

<br />

<br />

Constant Value:

-65536
(0xffff0000)


### TRANSPARENT

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TRANSPARENT
```

<br />

<br />

Constant Value:

0
(0x00000000)


### WHITE

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int WHITE
```

<br />

<br />

Constant Value:

-1
(0xffffffff)


### YELLOW

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int YELLOW
```

<br />

<br />

Constant Value:

-256
(0xffffff00)


## Public constructors

### Color

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Color ()
```

Creates a new color instance set to opaque black in the
`https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space.

<br />

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#valueOf(float,%20float,%20float)`
- `https://developer.android.com/reference/android/graphics/Color#valueOf(float,%20float,%20float,%20float)`
- `https://developer.android.com/reference/android/graphics/Color#valueOf(float,%20float,%20float,%20float,%20android.graphics.ColorSpace)`
- `https://developer.android.com/reference/android/graphics/Color#valueOf(float[],%20android.graphics.ColorSpace)`
- `https://developer.android.com/reference/android/graphics/Color#valueOf(int)`
- `https://developer.android.com/reference/android/graphics/Color#valueOf(long)`

## Public methods

### HSVToColor

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int HSVToColor (float[] hsv)
```

Convert HSV components to an ARGB color. Alpha set to 0xFF.

- `hsv[0]` is Hue \\(\[0..360\[\\)
- `hsv[1]` is Saturation \\(\[0...1\]\\)
- `hsv[2]` is Value \\(\[0...1\]\\)

If hsv values are out of range, they are pinned.

<br />

<br />

| Parameters ||
|---|---|
| `hsv` | `float`: 3 element array which holds the input HSV components. <br /> |

| Returns ||
|---|---|
| `int` | the resulting argb color <br /> |

### HSVToColor

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int HSVToColor (int alpha, 
                float[] hsv)
```

Convert HSV components to an ARGB color. The alpha component is passed
through unchanged.

- `hsv[0]` is Hue \\(\[0..360\[\\)
- `hsv[1]` is Saturation \\(\[0...1\]\\)
- `hsv[2]` is Value \\(\[0...1\]\\)

If hsv values are out of range, they are pinned.

<br />

<br />

| Parameters ||
|---|---|
| `alpha` | `int`: the alpha component of the returned argb color. Value is between 0 and 255 inclusive <br /> |
| `hsv` | `float`: 3 element array which holds the input HSV components. <br /> |

| Returns ||
|---|---|
| `int` | the resulting argb color <br /> |

### RGBToHSV

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void RGBToHSV (int red, 
                int green, 
                int blue, 
                float[] hsv)
```

Convert RGB components to HSV.

- `hsv[0]` is Hue \\(\[0..360\[\\)
- `hsv[1]` is Saturation \\(\[0...1\]\\)
- `hsv[2]` is Value \\(\[0...1\]\\)

<br />

<br />

| Parameters ||
|---|---|
| `red` | `int`: red component value \\(\[0..255\]\\). Value is between 0 and 255 inclusive <br /> |
| `green` | `int`: green component value \\(\[0..255\]\\). Value is between 0 and 255 inclusive <br /> |
| `blue` | `int`: blue component value \\(\[0..255\]\\). Value is between 0 and 255 inclusive <br /> |
| `hsv` | `float`: 3 element array which holds the resulting HSV components. <br /> |

### alpha

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int alpha (int color)
```

Return the alpha component of a color int. This is the same as saying
color \>\>\> 24

<br />

| Parameters ||
|---|---|
| `color` | `int` <br /> |

| Returns ||
|---|---|
| `int` | Value is between 0 and 255 inclusive <br /> |

### alpha

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float alpha ()
```

Returns the value of the alpha component in the range \\(\[0..1\]\\).
Calling this method is equivalent to
`getComponent(getComponentCount() - 1)`.

<br />

| Returns ||
|---|---|
| `float` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#red()`
- `https://developer.android.com/reference/android/graphics/Color#green()`
- `https://developer.android.com/reference/android/graphics/Color#blue()`
- `https://developer.android.com/reference/android/graphics/Color#getComponents()`
- `https://developer.android.com/reference/android/graphics/Color#getComponent(int)`

### alpha

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static float alpha (long color)
```

Returns the alpha component encoded in the specified color long.
The returned value is always in the range \\(\[0..1\]\\).

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long whose alpha channel to extract <br /> |

| Returns ||
|---|---|
| `float` | A float value in the range \\(\[0..1\]\\) <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#colorSpace(long)`
- `https://developer.android.com/reference/android/graphics/Color#red(long)`
- `https://developer.android.com/reference/android/graphics/Color#green(long)`
- `https://developer.android.com/reference/android/graphics/Color#blue(long)`

### argb

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int argb (int alpha, 
                int red, 
                int green, 
                int blue)
```

Return a color-int from alpha, red, green, blue components.
These component values should be \\(\[0..255\]\\), but there is no
range check performed, so if they are out of range, the
returned color is undefined.

<br />

| Parameters ||
|---|---|
| `alpha` | `int`: Alpha component \\(\[0..255\]\\) of the color. Value is between 0 and 255 inclusive <br /> |
| `red` | `int`: Red component \\(\[0..255\]\\) of the color. Value is between 0 and 255 inclusive <br /> |
| `green` | `int`: Green component \\(\[0..255\]\\) of the color. Value is between 0 and 255 inclusive <br /> |
| `blue` | `int`: Blue component \\(\[0..255\]\\) of the color. Value is between 0 and 255 inclusive <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

### argb

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int argb (float alpha, 
                float red, 
                float green, 
                float blue)
```

Return a color-int from alpha, red, green, blue float components
in the range \\(\[0..1\]\\). If the components are out of range, the
returned color is undefined.

<br />

| Parameters ||
|---|---|
| `alpha` | `float`: Alpha component \\(\[0..1\]\\) of the color <br /> |
| `red` | `float`: Red component \\(\[0..1\]\\) of the color <br /> |
| `green` | `float`: Green component \\(\[0..1\]\\) of the color <br /> |
| `blue` | `float`: Blue component \\(\[0..1\]\\) of the color <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

### blue

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int blue (int color)
```

Return the blue component of a color int. This is the same as saying
color \& 0xFF

<br />

| Parameters ||
|---|---|
| `color` | `int` <br /> |

| Returns ||
|---|---|
| `int` | Value is between 0 and 255 inclusive <br /> |

### blue

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float blue ()
```

<br />

Returns the value of the blue component in the range defined by this
color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and
`https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`).

If this color's color model is not `https://developer.android.com/reference/android/graphics/ColorSpace.Model#RGB`,
calling this method is equivalent to `getComponent(2)`.

<br />

<br />

| Returns ||
|---|---|
| `float` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#alpha()`
- `https://developer.android.com/reference/android/graphics/Color#red()`
- `https://developer.android.com/reference/android/graphics/Color#green()`
- `https://developer.android.com/reference/android/graphics/Color#getComponents()`

### blue

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static float blue (long color)
```

Returns the blue component encoded in the specified color long.
The range of the returned value depends on the color space
associated with the specified color. The color space can be
queried by calling `https://developer.android.com/reference/android/graphics/Color#colorSpace(long)`.

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long whose blue channel to extract <br /> |

| Returns ||
|---|---|
| `float` | A float value with a range defined by the specified color's color space <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#colorSpace(long)`
- `https://developer.android.com/reference/android/graphics/Color#red(long)`
- `https://developer.android.com/reference/android/graphics/Color#green(long)`
- `https://developer.android.com/reference/android/graphics/Color#alpha(long)`

### colorSpace

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ColorSpace colorSpace (long color)
```

Returns the color space encoded in the specified color long.

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long whose color space to extract <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace` | A non-null color space instance <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the encoded color space is invalid or unknown |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#red(long)`
- `https://developer.android.com/reference/android/graphics/Color#green(long)`
- `https://developer.android.com/reference/android/graphics/Color#blue(long)`
- `https://developer.android.com/reference/android/graphics/Color#alpha(long)`

### colorToHSV

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static void colorToHSV (int color, 
                float[] hsv)
```

Convert the ARGB color to its HSV components.

- `hsv[0]` is Hue \\(\[0..360\[\\)
- `hsv[1]` is Saturation \\(\[0...1\]\\)
- `hsv[2]` is Value \\(\[0...1\]\\)

<br />

<br />

| Parameters ||
|---|---|
| `color` | `int`: the argb color to convert. The alpha component is ignored. <br /> |
| `hsv` | `float`: 3 element array which holds the resulting HSV components. <br /> |

### convert

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long convert (long color, 
                ColorSpace.Connector connector)
```

<br />

Converts the specified color long from a color space to another using the
specified color space `https://developer.android.com/reference/android/graphics/ColorSpace.Connector`. The resulting
color is returned as a color long. See the documentation of this class for a
description of the color long format.

When converting several colors in a row, this method is preferable to
`https://developer.android.com/reference/android/graphics/Color#convert(long,%20android.graphics.ColorSpace)` as it prevents a new connector from being
created on every invocation.

The connector's source color space should match the color long's
color space.

<br />

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long to convert <br /> |
| `connector` | `ColorSpace.Connector`: A color space connector, cannot be null <br /> |

| Returns ||
|---|---|
| `long` | A color long in the destination color space of the connector <br /> |

### convert

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Color convert (ColorSpace colorSpace)
```

Converts this color from its color space to the specified color space.
The conversion is done using the default rendering intent as specified
by `https://developer.android.com/reference/android/graphics/ColorSpace#connect(android.graphics.ColorSpace,%20android.graphics.ColorSpace)`.

<br />

| Parameters ||
|---|---|
| `colorSpace` | `ColorSpace`: The destination color space, cannot be null <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Color` | A non-null color instance in the specified color space <br /> |

### convert

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long convert (int color, 
                ColorSpace colorSpace)
```

Converts the specified ARGB color int from the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB`
color space into the specified destination color space. The resulting color is
returned as a color long. See the documentation of this class for a description
of the color long format.

<br />

| Parameters ||
|---|---|
| `color` | `int`: The sRGB color int to convert <br /> |
| `colorSpace` | `ColorSpace`: The destination color space. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `long` | A color long in the destination color space <br /> |

### convert

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long convert (float r, 
                float g, 
                float b, 
                float a, 
                ColorSpace source, 
                ColorSpace destination)
```

<br />

Converts the specified 3 component color from the source color space to the
destination color space. The resulting color is returned as a color long. See
the documentation of this class for a description of the color long format.

When converting multiple colors in a row, it is recommended to use
`https://developer.android.com/reference/android/graphics/Color#convert(float,%20float,%20float,%20float,%20android.graphics.ColorSpace.Connector)` instead to
avoid the creation of a `https://developer.android.com/reference/android/graphics/ColorSpace.Connector` on every invocation.

The red, green and blue components must be in the range defined by the
specified color space. See `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and
`https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`.

<br />

<br />

| Parameters ||
|---|---|
| `r` | `float`: The red component of the color to convert <br /> |
| `g` | `float`: The green component of the color to convert <br /> |
| `b` | `float`: The blue component of the color to convert <br /> |
| `a` | `float`: The alpha component of the color to convert, in \\(\[0..1\]\\) <br /> |
| `source` | `ColorSpace`: The source color space, cannot be null <br /> |
| `destination` | `ColorSpace`: The destination color space, cannot be null <br /> |

| Returns ||
|---|---|
| `long` | A color long in the destination color space <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#convert(float,%20float,%20float,%20float,%20android.graphics.ColorSpace.Connector)`

### convert

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long convert (float r, 
                float g, 
                float b, 
                float a, 
                ColorSpace.Connector connector)
```

<br />

Converts the specified 3 component color from a color space to another using
the specified color space `https://developer.android.com/reference/android/graphics/ColorSpace.Connector`. The resulting
color is returned as a color long. See the documentation of this class for a
description of the color long format.

When converting several colors in a row, this method is preferable to
`https://developer.android.com/reference/android/graphics/Color#convert(float,%20float,%20float,%20float,%20android.graphics.ColorSpace,%20android.graphics.ColorSpace)` as
it prevents a new connector from being created on every invocation.

The red, green and blue components must be in the range defined by the
source color space of the connector. See `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)`
and `https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`.

<br />

<br />

| Parameters ||
|---|---|
| `r` | `float`: The red component of the color to convert <br /> |
| `g` | `float`: The green component of the color to convert <br /> |
| `b` | `float`: The blue component of the color to convert <br /> |
| `a` | `float`: The alpha component of the color to convert, in \\(\[0..1\]\\) <br /> |
| `connector` | `ColorSpace.Connector`: A color space connector, cannot be null <br /> |

| Returns ||
|---|---|
| `long` | A color long in the destination color space of the connector <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#convert(float,%20float,%20float,%20float,%20android.graphics.ColorSpace,%20android.graphics.ColorSpace)`

### convert

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long convert (long color, 
                ColorSpace colorSpace)
```

<br />

Converts the specified color long from its color space into the specified
destination color space. The resulting color is returned as a color long. See
the documentation of this class for a description of the color long format.

When converting several colors in a row, it is recommended to use
`https://developer.android.com/reference/android/graphics/Color#convert(long,%20android.graphics.ColorSpace.Connector)` instead to
avoid the creation of a `https://developer.android.com/reference/android/graphics/ColorSpace.Connector` on every invocation.

<br />

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long to convert <br /> |
| `colorSpace` | `ColorSpace`: The destination color space. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `long` | A color long in the destination color space <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the encoded color space is invalid or unknown |

### equals

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

Indicates whether some other object is "equal to" this one.


The `equals` method implements an equivalence relation
on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.


An equivalence relation partitions the elements it operates on
into *equivalence classes*; all the members of an
equivalence class are equal to each other. Members of an
equivalence class are substitutable for each other, at least
for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getColorSpace

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ColorSpace getColorSpace ()
```

Returns this color's color space.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace` | A non-null instance of `https://developer.android.com/reference/android/graphics/ColorSpace` <br /> |

### getComponent

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float getComponent (int component)
```

<br />

Returns the value of the specified component in the range defined by
this color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and
`https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`).

If the requested component index is `https://developer.android.com/reference/android/graphics/Color#getComponentCount()`,
this method returns the alpha component, always in the range
\\(\[0..1\]\\).

<br />

<br />

| Parameters ||
|---|---|
| `component` | `int`: Value is between 0 and 4 inclusive <br /> |

| Returns ||
|---|---|
| `float` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException` | If the specified component index is \< 0 or \>= `https://developer.android.com/reference/android/graphics/Color#getComponentCount()` |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#getComponents()`

### getComponentCount

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getComponentCount ()
```

Returns the number of components that form a color value according
to this color space's color model, plus one extra component for
alpha.

<br />

| Returns ||
|---|---|
| `int` | The integer 4 or 5. Value is between 4 and 5 inclusive <br /> |

### getComponents

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float[] getComponents ()
```

Returns this color's components as a new array. The last element of the
array is always the alpha component.

<br />

| Returns ||
|---|---|
| `float[]` | A new, non-null array whose size is equal to `https://developer.android.com/reference/android/graphics/Color#getComponentCount()` <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#getComponent(int)`

### getComponents

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float[] getComponents (float[] components)
```

Copies this color's components in the supplied array. The last element of the
array is always the alpha component.

<br />

| Parameters ||
|---|---|
| `components` | `float`: An array of floats whose size must be at least `https://developer.android.com/reference/android/graphics/Color#getComponentCount()`, can be null <br /> |

| Returns ||
|---|---|
| `float[]` | The array passed as a parameter if not null, or a new array of length `https://developer.android.com/reference/android/graphics/Color#getComponentCount()` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified array's length is less than `https://developer.android.com/reference/android/graphics/Color#getComponentCount()` |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#getComponent(int)`

### getModel

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ColorSpace.Model getModel ()
```

Returns the color model of this color.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/ColorSpace.Model` | A non-null `https://developer.android.com/reference/android/graphics/ColorSpace.Model` <br /> |

### green

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static float green (long color)
```

Returns the green component encoded in the specified color long.
The range of the returned value depends on the color space
associated with the specified color. The color space can be
queried by calling `https://developer.android.com/reference/android/graphics/Color#colorSpace(long)`.

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long whose green channel to extract <br /> |

| Returns ||
|---|---|
| `float` | A float value with a range defined by the specified color's color space <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#colorSpace(long)`
- `https://developer.android.com/reference/android/graphics/Color#red(long)`
- `https://developer.android.com/reference/android/graphics/Color#blue(long)`
- `https://developer.android.com/reference/android/graphics/Color#alpha(long)`

### green

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float green ()
```

<br />

Returns the value of the green component in the range defined by this
color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and
`https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`).

If this color's color model is not `https://developer.android.com/reference/android/graphics/ColorSpace.Model#RGB`,
calling this method is equivalent to `getComponent(1)`.

<br />

<br />

| Returns ||
|---|---|
| `float` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#alpha()`
- `https://developer.android.com/reference/android/graphics/Color#red()`
- `https://developer.android.com/reference/android/graphics/Color#green()`
- `https://developer.android.com/reference/android/graphics/Color#getComponents()`

### green

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int green (int color)
```

Return the green component of a color int. This is the same as saying
(color \>\> 8) \& 0xFF

<br />

| Parameters ||
|---|---|
| `color` | `int` <br /> |

| Returns ||
|---|---|
| `int` | Value is between 0 and 255 inclusive <br /> |

### hashCode

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
`https://developer.android.com/reference/java/util/HashMap`.


The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### isInColorSpace

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isInColorSpace (long color, 
                ColorSpace colorSpace)
```

Indicates whether the specified color is in the specified color space.

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color to test <br /> |
| `colorSpace` | `ColorSpace`: The color space to test against. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | True if the color is in the specified color space, false otherwise <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#isSrgb(long)`
- `https://developer.android.com/reference/android/graphics/Color#isWideGamut(long)`

### isSrgb

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isSrgb ()
```

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

<br />

| Returns ||
|---|---|
| `boolean` | True if this color is in the sRGB color space, false otherwise <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#isWideGamut()`

### isSrgb

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isSrgb (long color)
```

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

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color to test <br /> |

| Returns ||
|---|---|
| `boolean` | True if the color is in the sRGB color space, false otherwise <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the encoded color space is invalid or unknown |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#isInColorSpace(long,%20android.graphics.ColorSpace)`
- `https://developer.android.com/reference/android/graphics/Color#isWideGamut(long)`

### isWideGamut

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static boolean isWideGamut (long color)
```

Indicates whether the specified color is in a wide-gamut color space.
See `https://developer.android.com/reference/android/graphics/ColorSpace#isWideGamut()` for a definition of a wide-gamut
color space.

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color to test <br /> |

| Returns ||
|---|---|
| `boolean` | True if the color is in a wide-gamut color space, false otherwise <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the encoded color space is invalid or unknown |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#isInColorSpace(long,%20android.graphics.ColorSpace)`
- `https://developer.android.com/reference/android/graphics/Color#isSrgb(long)`
- `https://developer.android.com/reference/android/graphics/ColorSpace#isWideGamut()`

### isWideGamut

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isWideGamut ()
```

Indicates whether this color color is in a wide-gamut color space.
See `https://developer.android.com/reference/android/graphics/ColorSpace#isWideGamut()` for a definition of a wide-gamut
color space.

<br />

| Returns ||
|---|---|
| `boolean` | True if this color is in a wide-gamut color space, false otherwise <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#isSrgb()`
- `https://developer.android.com/reference/android/graphics/ColorSpace#isWideGamut()`

### luminance

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static float luminance (long color)
```

<br />

Returns the relative luminance of a color.

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

<br />

<br />

| Parameters ||
|---|---|
| `color` | `long` <br /> |

| Returns ||
|---|---|
| `float` | A value between 0 (darkest black) and 1 (lightest white) <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified color's color space is unknown or does not use the `https://developer.android.com/reference/android/graphics/ColorSpace.Model#RGB` color model |

### luminance

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static float luminance (int color)
```

Returns the relative luminance of a color.


Assumes sRGB encoding. Based on the formula for relative luminance
defined in WCAG 2.0, W3C Recommendation 11 December 2008.

<br />

| Parameters ||
|---|---|
| `color` | `int` <br /> |

| Returns ||
|---|---|
| `float` | a value between 0 (darkest black) and 1 (lightest white) <br /> |

### luminance

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float luminance ()
```

<br />

Returns the relative luminance of this color.

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

<br />

<br />

| Returns ||
|---|---|
| `float` | A value between 0 (darkest black) and 1 (lightest white) <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the this color's color space does not use the `https://developer.android.com/reference/android/graphics/ColorSpace.Model#RGB` color model |

### pack

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long pack (int color)
```

Converts the specified ARGB color int to an RGBA color long in the sRGB
color space. See the documentation of this class for a description of
the color long format.

<br />

| Parameters ||
|---|---|
| `color` | `int`: The ARGB color int to convert to an RGBA color long in sRGB <br /> |

| Returns ||
|---|---|
| `long` | A color long <br /> |

### pack

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long pack (float red, 
                float green, 
                float blue, 
                float alpha)
```

Packs the sRGB color defined by the specified red, green, blue and alpha
component values into an RGBA color long in the sRGB color space. See the
documentation of this class for a description of the color long format.

<br />

| Parameters ||
|---|---|
| `red` | `float`: The red component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `green` | `float`: The green component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `blue` | `float`: The blue component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `alpha` | `float`: The alpha component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |

| Returns ||
|---|---|
| `long` | A color long <br /> |

### pack

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long pack (float red, 
                float green, 
                float blue, 
                float alpha, 
                ColorSpace colorSpace)
```

<br />

Packs the 3 component color defined by the specified red, green, blue and
alpha component values into a color long in the specified color space. See the
documentation of this class for a description of the color long format.

The red, green and blue components must be in the range defined by the
specified color space. See `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and
`https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`.

<br />

<br />

| Parameters ||
|---|---|
| `red` | `float`: The red component of the color to create <br /> |
| `green` | `float`: The green component of the color to create <br /> |
| `blue` | `float`: The blue component of the color to create <br /> |
| `alpha` | `float`: The alpha component of the color to create, in \\(\[0..1\]\\) <br /> |
| `colorSpace` | `ColorSpace`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `long` | A color long <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the color space's id is `https://developer.android.com/reference/android/graphics/ColorSpace#MIN_ID` or if the color space's color model has more than 3 components |

### pack

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static long pack (float red, 
                float green, 
                float blue)
```

Packs the sRGB color defined by the specified red, green and blue component
values into an RGBA color long in the sRGB color space. The alpha component
is set to 1.0. See the documentation of this class for a description of the
color long format.

<br />

| Parameters ||
|---|---|
| `red` | `float`: The red component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `green` | `float`: The green component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `blue` | `float`: The blue component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |

| Returns ||
|---|---|
| `long` | A color long <br /> |

### pack

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long pack ()
```

Packs this color into a color long. See the documentation of this class
for a description of the color long format.

<br />

| Returns ||
|---|---|
| `long` | A color long <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If this color's color space has the id `https://developer.android.com/reference/android/graphics/ColorSpace#MIN_ID` or if this color has more than 4 components |

### parseColor

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int parseColor (String colorString)
```

<br />

Parse the color string, and return the corresponding color-int. If the string cannot be parsed, throws an IllegalArgumentException exception. Supported formats are:

<br />

- `#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`,
and `teal`.

<br />

<br />

| Parameters ||
|---|---|
| `colorString` | `String` <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

### red

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public float red ()
```

<br />

Returns the value of the red component in the range defined by this
color's color space (see `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and
`https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`).

If this color's color model is not `https://developer.android.com/reference/android/graphics/ColorSpace.Model#RGB`,
calling this method is equivalent to `getComponent(0)`.

<br />

<br />

| Returns ||
|---|---|
| `float` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#alpha()`
- `https://developer.android.com/reference/android/graphics/Color#red()`
- `https://developer.android.com/reference/android/graphics/Color#green()`
- `https://developer.android.com/reference/android/graphics/Color#getComponents()`

### red

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static float red (long color)
```

Returns the red component encoded in the specified color long.
The range of the returned value depends on the color space
associated with the specified color. The color space can be
queried by calling `https://developer.android.com/reference/android/graphics/Color#colorSpace(long)`.

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long whose red channel to extract <br /> |

| Returns ||
|---|---|
| `float` | A float value with a range defined by the specified color's color space <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/Color#colorSpace(long)`
- `https://developer.android.com/reference/android/graphics/Color#green(long)`
- `https://developer.android.com/reference/android/graphics/Color#blue(long)`
- `https://developer.android.com/reference/android/graphics/Color#alpha(long)`

### red

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int red (int color)
```

Return the red component of a color int. This is the same as saying
(color \>\> 16) \& 0xFF

<br />

| Parameters ||
|---|---|
| `color` | `int` <br /> |

| Returns ||
|---|---|
| `int` | Value is between 0 and 255 inclusive <br /> |

### rgb

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int rgb (float red, 
                float green, 
                float blue)
```

Return a color-int from red, green, blue float components
in the range \\(\[0..1\]\\). The alpha component is implicitly
1.0 (fully opaque). If the components are out of range, the
returned color is undefined.

<br />

| Parameters ||
|---|---|
| `red` | `float`: Red component \\(\[0..1\]\\) of the color <br /> |
| `green` | `float`: Green component \\(\[0..1\]\\) of the color <br /> |
| `blue` | `float`: Blue component \\(\[0..1\]\\) of the color <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

### rgb

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int rgb (int red, 
                int green, 
                int blue)
```

Return a color-int from red, green, blue components.
The alpha component is implicitly 255 (fully opaque).
These component values should be \\(\[0..255\]\\), but there is no
range check performed, so if they are out of range, the
returned color is undefined.

<br />

| Parameters ||
|---|---|
| `red` | `int`: Red component \\(\[0..255\]\\) of the color. Value is between 0 and 255 inclusive <br /> |
| `green` | `int`: Green component \\(\[0..255\]\\) of the color. Value is between 0 and 255 inclusive <br /> |
| `blue` | `int`: Blue component \\(\[0..255\]\\) of the color. Value is between 0 and 255 inclusive <br /> |

| Returns ||
|---|---|
| `int` | <br /> |

### toArgb

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int toArgb ()
```

Converts this color to an ARGB color int. A color int is always in
the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space. This implies
a color space conversion is applied if needed.

<br />

| Returns ||
|---|---|
| `int` | An ARGB color in the sRGB color space <br /> |

### toArgb

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static int toArgb (long color)
```

Converts the specified color long to an ARGB color int. A color int is
always in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB` color space. This implies
a color space conversion is applied if needed.

<br />

| Parameters ||
|---|---|
| `color` | `long` <br /> |

| Returns ||
|---|---|
| `int` | An ARGB color in the sRGB color space <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the encoded color space is invalid or unknown |

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

<br />

Returns a string representation of the object. This method returns
a string equal to the value of:

```
"Color(" + r + ", " + g + ", " + b + ", " + a +
        ", " + getColorSpace().getName + ')'
```

For instance, the string representation of opaque black in the sRGB
color space is equal to the following value:

```
Color(0.0, 0.0, 0.0, 1.0, sRGB IEC61966-2.1)
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A non-null string representation of the object <br /> |

### valueOf

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Color valueOf (float r, 
                float g, 
                float b)
```

Creates a new opaque `Color` in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB`
color space with the specified red, green and blue component values. The component
values must be in the range \\(\[0..1\]\\).

<br />

| Parameters ||
|---|---|
| `r` | `float`: The red component of the opaque sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `g` | `float`: The green component of the opaque sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `b` | `float`: The blue component of the opaque sRGB color to create, in \\(\[0..1\]\\) <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Color` | A non-null instance of `https://developer.android.com/reference/android/graphics/Color` <br /> |

### valueOf

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Color valueOf (float r, 
                float g, 
                float b, 
                float a)
```

Creates a new `Color` in the `https://developer.android.com/reference/android/graphics/ColorSpace.Named#SRGB`
color space with the specified red, green, blue and alpha component values.
The component values must be in the range \\(\[0..1\]\\).

<br />

| Parameters ||
|---|---|
| `r` | `float`: The red component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `g` | `float`: The green component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `b` | `float`: The blue component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |
| `a` | `float`: The alpha component of the sRGB color to create, in \\(\[0..1\]\\) <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Color` | A non-null instance of `https://developer.android.com/reference/android/graphics/Color` <br /> |

### valueOf

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Color valueOf (int color)
```

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

<br />

| Parameters ||
|---|---|
| `color` | `int`: The ARGB color int to create a `Color` from <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Color` | A non-null instance of `https://developer.android.com/reference/android/graphics/Color` <br /> |

### valueOf

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Color valueOf (float[] components, 
                ColorSpace colorSpace)
```

<br />

Creates a new `Color` in the specified color space with the
specified component values. The range of the components is defined by
`https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and `https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`.
The values passed to this method must be in the proper range. The alpha
component is always in the range \\(\[0..1\]\\).

The length of the array of components must be at least
`` `https://developer.android.com/reference/android/graphics/ColorSpace#getComponentCount()` + 1 ``. The component at index
`https://developer.android.com/reference/android/graphics/ColorSpace#getComponentCount()` is always alpha.

<br />

<br />

| Parameters ||
|---|---|
| `components` | `float`: The components of the color to create, with alpha as the last component. This value cannot be `null`. <br /> |
| `colorSpace` | `ColorSpace`: The color space of the color to create. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Color` | A non-null instance of `https://developer.android.com/reference/android/graphics/Color` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the array of components is smaller than required by the color space |

### valueOf

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Color valueOf (long color)
```

Creates a new `Color` instance from a color long.
The resulting color is in the same color space as the specified color long.

<br />

| Parameters ||
|---|---|
| `color` | `long`: The color long to create a `Color` from <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Color` | A non-null instance of `https://developer.android.com/reference/android/graphics/Color` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the encoded color space is invalid or unknown |

### valueOf

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Color valueOf (float r, 
                float g, 
                float b, 
                float a, 
                ColorSpace colorSpace)
```

Creates a new `Color` in the specified color space with the
specified red, green, blue and alpha component values. The range of the
components is defined by `https://developer.android.com/reference/android/graphics/ColorSpace#getMinValue(int)` and
`https://developer.android.com/reference/android/graphics/ColorSpace#getMaxValue(int)`. The values passed to this method
must be in the proper range.

<br />

| Parameters ||
|---|---|
| `r` | `float`: The red component of the color to create <br /> |
| `g` | `float`: The green component of the color to create <br /> |
| `b` | `float`: The blue component of the color to create <br /> |
| `a` | `float`: The alpha component of the color to create, in \\(\[0..1\]\\) <br /> |
| `colorSpace` | `ColorSpace`: The color space of the color to create. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Color` | A non-null instance of `https://developer.android.com/reference/android/graphics/Color` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the specified color space uses a color model with more than 3 components |