ColorRGBa

A generic RGB color space capable of representing both the linear and the sRGB color spaces.

See also

Parameters

r

red as a percentage between 0.0 and 1.0

g

green as a percentage between 0.0 and 1.0

b

blue as a percentage between 0.0 and 1.0

a

alpha as a percentage between 0.0 and 1.0

Constructors

ColorRGBa
Link copied to clipboard
fun ColorRGBa(r: Double, g: Double, b: Double, a: Double = 1.0, linearity: Linearity = Linearity.UNKNOWN)

Types

Companion
Link copied to clipboard
object Companion
Component
Link copied to clipboard
enum Component : Enum<ColorRGBa.Component>

Functions

div
Link copied to clipboard
open operator override fun div(scale: Double): ColorRGBa
getContrastRatio
Link copied to clipboard
fun getContrastRatio(other: ColorRGBa): Double

calculate the contrast value between this color and the given color contrast value is accordingo to // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef

hashCode
Link copied to clipboard
open override fun hashCode(): Int
invoke
Link copied to clipboard
operator fun invoke(r: Double = this.r, g: Double = this.g, b: Double = this.b, a: Double = this.a): ColorRGBa
minus
Link copied to clipboard
open operator override fun minus(right: ColorRGBa): ColorRGBa
mix
Link copied to clipboard
open override fun mix(other: ColorRGBa, factor: Double): ColorRGBa
opacify
Link copied to clipboard
open override fun opacify(factor: Double): ColorRGBa

Creates a copy of color with adjusted opacity

plus
Link copied to clipboard
open operator override fun plus(right: ColorRGBa): ColorRGBa
shade
Link copied to clipboard
open override fun shade(factor: Double): ColorRGBa

Creates a copy of color with adjusted color

times
Link copied to clipboard
open operator override fun times(scale: Double): ColorRGBa
toHSLa
Link copied to clipboard
fun toHSLa(): ColorHSLa
toHSVa
Link copied to clipboard
fun toHSVa(): ColorHSVa
toLABa
Link copied to clipboard
fun toLABa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLABa
toLCHABa
Link copied to clipboard
fun toLCHABa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLCHABa
toLCHUVa
Link copied to clipboard
fun toLCHUVa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLCHUVa
toLinear
Link copied to clipboard
fun toLinear(): ColorRGBa

Convert to linear RGB

toLUVa
Link copied to clipboard
fun toLUVa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLUVa
toRGBa
Link copied to clipboard
open override fun toRGBa(): ColorRGBa

Convert into ColorRGBa.

toSRGB
Link copied to clipboard
fun toSRGB(): ColorRGBa

Convert to SRGB

toVector4
Link copied to clipboard
open override fun toVector4(): Vector4
toXSLa
Link copied to clipboard
fun toXSLa(): ColorXSLa
toXSVa
Link copied to clipboard
fun toXSVa(): ColorXSVa
toXYZa
Link copied to clipboard
fun toXYZa(): ColorXYZa

Properties

a
Link copied to clipboard
val a: Double = 1.0
alphaMultiplied
Link copied to clipboard
val alphaMultiplied: ColorRGBa
b
Link copied to clipboard
val b: Double
g
Link copied to clipboard
val g: Double
linearity
Link copied to clipboard
val linearity: Linearity
luminance
Link copied to clipboard
val luminance: Double

calculate luminance value luminance value is according to https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

maxValue
Link copied to clipboard
val maxValue: Double

The maximum value over r, g, b

minValue
Link copied to clipboard
val minValue: Double

The minimum value over r, g, b

r
Link copied to clipboard
val r: Double
saturated
Link copied to clipboard
val saturated: ColorRGBa

Copy of the the color with all of its fields clamped to [0, 1]