Skip to content

HsvColor

@Immutable



data class HsvColor(
    val hue: Float, 
    val saturation: Float, 
    val value: Float, 
    val alpha: Float
)

An immutable colour representation using the Hue-Saturation-Value model with an alpha channel.

This representation is primarily intended for use with net.kernelpanicsoft.archie.gui.composables.input.ColorPicker, which operates natively in HSV space to avoid lossy round-trip conversions.

All component values are in the range 0.0, 1.0.

Example

val red      = HsvColor(hue = 0f,    saturation = 1f, value = 1f, alpha = 1f)
val fromKColor = HsvColor.from(KColor.CYAN)
val backToKColor = red.toKColor()

Constructors

HsvColor

constructor(
    hue: Float, 
    saturation: Float, 
    value: Float, 
    alpha: Float
)

Types

Companion

object Companion

Properties

alpha

val alpha: Float

hue

val hue: Float

saturation

value

val value: Float

Functions

toKColor

fun toKColor(): KColor

Converts this HSV colour to an equivalent KColor (ARGB).