Color

abstract class Color(source)

The superclass for all displayable colors.

Colors can be defined in either the Red-Green-Blue (RGB) space using Color.RGB or the Hue-Saturation-Lightness (HSL) space using Color.HSL. Colors can be converted between color spaces after they are created, but this may result in a loss of precision (e.g., converting from RGB to HSL and back again may result in a slightly different color).

Inheritors

Types

Link copied to clipboard
class HSL(hue: Float, saturation: Float, lightness: Float, alpha: Float = 1.0f) : Color

A color in the Hue-Saturation-Lightness (HSL) space.

Link copied to clipboard
class RGB(val red: UByte, val green: UByte, val blue: UByte, alpha: Float = 1.0f) : Color

A color in the Red-Green-Blue (RGB) space.

Properties

Link copied to clipboard

The alpha component for the color, from 0f to 1f

Functions

Link copied to clipboard
abstract fun toHSL(): Color.HSL

Converts the color to the Hue-Saturation-Lightness (HSL) space.

Link copied to clipboard
abstract fun toRGB(): Color.RGB

Converts the color to the Red-Green-Blue (RGB) space.

Link copied to clipboard
abstract override fun toString(): String