Color.Companion



Summary

Public functions

Color
hsl(
    hue: Float,
    saturation: Float,
    lightness: Float,
    alpha: Float,
    colorSpace: Rgb
)

Return a Color from hue, saturation, and lightness (HSL representation).

Cmn
Color
hsv(hue: Float, saturation: Float, value: Float, alpha: Float, colorSpace: Rgb)

Return a Color from hue, saturation, and value (HSV representation).

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 properties

(colorSpace: ColorSpace) -> TwoWayConverter<ColorAnimationVector4D>

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.

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 hue represented in the color in the range (0..1), where 0 has no color and 1 is fully saturated.

lightness: Float

A range of (0..1) where 0 is black, 0.5 is fully colored, and 1 is white.

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 hue represented in the color in the range (0..1), where 0 has no color and 1 is fully saturated.

value: Float

The strength of the color, where 0 is black.

colorSpace: Rgb = ColorSpaces.Srgb

The RGB color space used to calculate the Color from the HSV values.

Public properties

Black

val BlackColor

Blue

val BlueColor

Cyan

val CyanColor

DarkGray

val DarkGrayColor

Gray

val GrayColor

Green

val GreenColor

LightGray

val LightGrayColor

Magenta

val MagentaColor

Red

val RedColor

Transparent

val TransparentColor

Unspecified

val UnspecifiedColor

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.

White

val WhiteColor

Yellow

val YellowColor

Extension properties

VectorConverter

val Color.Companion.VectorConverter: (colorSpace: ColorSpace) -> TwoWayConverter<ColorAnimationVector4D>

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.