Create a Color by passing individual red, green, blue, alpha, and colorSpace
components. The default color space is sRGB and the default
alpha is 1.0 (opaque).
If the red, green, or blue values are outside of the range defined by colorSpace (see
ColorSpace.getMinValue and ColorSpace.getMaxValue, these values get clamped appropriately to
be within range.
Common
funColor(@ColorInt color: Int): Color
Creates a new Color instance from an ARGB color int. The resulting color is in the
sRGB color space.
Parameters
color
The ARGB color int to create a Color from.
Returns
A non-null instance of {@link Color}
Common
funColor(color: Long): Color
Creates a new Color instance from an ARGB color int. The resulting color is in the
sRGB color space. This is useful for specifying colors with alpha greater
than 0x80 in numeric form without using Long.toInt:
val color = Color(0xFF000080)
Parameters
color
The 32-bit ARGB color int to create a Color from
Returns
A non-null instance of {@link Color}
Common
funColor(@IntRange(from =0,to=0xFF) red: Int,@IntRange(from =0,to=0xFF) green: Int,@IntRange(from =0,to=0xFF) blue: Int,@IntRange(from =0,to=0xFF) alpha: Int =0xFF,): Color
Creates a new Color instance from an ARGB color components. The resulting color is in the
sRGB color space. The default alpha value is 0xFF (opaque).
Parameters
red
The red component of the color, between 0 and 255.
green
The green component of the color, between 0 and 255.
blue
The blue component of the color, between 0 and 255.
alpha
The alpha component of the color, between 0 and 255.