Color.Companion
-
Cmn
object Color.Companion
Summary
Public functions |
||
|---|---|---|
Color |
Return a |
Cmn
|
Color |
Return a |
Cmn
|
Public properties |
||
|---|---|---|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Cmn
|
|
Color |
Because Color is an inline class, this represents an unset value without having to box the Color. |
Cmn
|
Color |
Cmn
|
|
Color |
Cmn
|
Extension functions |
||
|---|---|---|
Color |
Color.Companion.fromColorLong(colorLong: @ColorLong Long)Creates a Color from an Android 64-bit color value. |
android
|
Extension properties |
||
|---|---|---|
(colorSpace: ColorSpace) -> TwoWayConverter<Color, AnimationVector4D> |
A lambda that takes a |
Cmn
|
Public functions
hsl
fun hsl(
hue: Float,
saturation: Float,
lightness: Float,
alpha: Float = 1.0f,
colorSpace: Rgb = ColorSpaces.Srgb
): Color
Return a Color from hue, saturation, and lightness (HSL representation).
| Parameters | |
|---|---|
hue: Float |
The color value in the range (0..360), where 0 is red, 120 is green, and 240 is blue |
saturation: Float |
The amount of |
lightness: Float |
A range of (0..1) where 0 is black, 0.5 is fully colored, and 1 is white. |
alpha: Float = 1.0f |
Alpha channel to apply to the computed color |
colorSpace: Rgb = ColorSpaces.Srgb |
The RGB color space used to calculate the Color from the HSL values. |
hsv
fun hsv(
hue: Float,
saturation: Float,
value: Float,
alpha: Float = 1.0f,
colorSpace: Rgb = ColorSpaces.Srgb
): Color
Return a Color from hue, saturation, and value (HSV representation).
| Parameters | |
|---|---|
hue: Float |
The color value in the range (0..360), where 0 is red, 120 is green, and 240 is blue |
saturation: Float |
The amount of |
value: Float |
The strength of the color, where 0 is black. |
alpha: Float = 1.0f |
Alpha channel to apply to the computed color |
colorSpace: Rgb = ColorSpaces.Srgb |
The RGB color space used to calculate the Color from the HSV values. |
Public properties
Unspecified
val Unspecified: Color
Because Color is an inline class, this represents an unset value without having to box the Color. It will be treated as Transparent when drawn. A Color can compare with Unspecified for equality or use isUnspecified to check for the unset value or isSpecified for any color that isn't Unspecified.
Extension functions
Color.Companion.fromColorLong
fun Color.Companion.fromColorLong(colorLong: @ColorLong Long): Color
Creates a Color from an Android 64-bit color value. This differs from the Color constructor accepting a Long in that the constructor assumes the incoming value is a 32-bit ARGB color, while this is a 64-bit ColorLong color from Android. Color.value isn't fully compatible with Android's 64-bit ColorLong values as some color spaces differ, so this method handles the conversion.
Extension properties
Color.Companion.VectorConverter
val Color.Companion.VectorConverter: (colorSpace: ColorSpace) -> TwoWayConverter<Color, AnimationVector4D>
A lambda that takes a ColorSpace and returns a converter that can both convert a Color to a AnimationVector4D, and convert a AnimationVector4D) back to a Color in the given ColorSpace.