IsoColor

data class IsoColor @JvmOverloads constructor(val r: Double, val g: Double, val b: Double, val a: Double = 255.0)

Represents a color with RGB and HSL representations.

Renamed from Color to IsoColor to avoid conflicts with platform Color classes (e.g., android.graphics.Color, androidx.compose.ui.graphics.Color).

All RGBA channel values are in the range 0–255. The derived HSL properties are lazily computed: h is a normalized hue in 0–1 (not 0–360), s is saturation in 0–1, and l is lightness in 0–1.

Parameters

r

Red channel (0–255)

g

Green channel (0–255)

b

Blue channel (0–255)

a

Alpha channel (0–255, default 255 = fully opaque)

Constructors

Link copied to clipboard
constructor(r: Double, g: Double, b: Double, a: Double = 255.0)
constructor(r: Int, g: Int, b: Int, a: Int = 255)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val a: Double
Link copied to clipboard
val b: Double
Link copied to clipboard
val g: Double
Link copied to clipboard
val h: Double

Hue component in 0–1 (normalized; multiply by 360 for degrees).

Link copied to clipboard
val l: Double

Lightness component in 0–1.

Link copied to clipboard
val r: Double
Link copied to clipboard
val s: Double

Saturation component in 0–1.

Functions

Link copied to clipboard
fun lighten(percentage: Double, lightColor: IsoColor): IsoColor

Produces a lighter variant of this color by blending with lightColor and then increasing the HSL lightness by percentage.

Link copied to clipboard

Converts this color to an IntArray of four integer RGBA components, each rounded to the nearest whole number in the 0–255 range.