openrndr / org.openrndr.color / ColorRGBa

ColorRGBa

data class ColorRGBa : ConvertibleToColorRGBa, OpacifiableColor<ColorRGBa>, ShadableColor<ColorRGBa>, AlgebraicColor<ColorRGBa> (source)

color in RGBa space

Parameters

r - red between 0 and 1

g - green between 0 and 1

b - blue between 0 and 1

a - alpha between 0 and 1

Types

Component

enum class Component

Constructors

<init>

color in RGBa space

ColorRGBa(r: Double, g: Double, b: Double, a: Double = 1.0, linearity: Linearity = Linearity.UNKNOWN)

Properties

a

alpha between 0 and 1

val a: Double

alphaMultiplied

val alphaMultiplied: ColorRGBa

b

blue between 0 and 1

val b: Double

g

green between 0 and 1

val g: Double

linearity

val linearity: Linearity

luminance

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

val luminance: Double

maxValue

The maximum value over r, g, b

val maxValue: Double

minValue

The minimum value over r, g, b

val minValue: Double

r

red between 0 and 1

val r: Double

saturated

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

val saturated: ColorRGBa

Functions

getContrastRatio

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

fun getContrastRatio(other: ColorRGBa): Double

hashCode

fun hashCode(): Int

invoke

operator fun invoke(r: Double = this.r, g: Double = this.g, b: Double = this.b, a: Double = this.a): ColorRGBa

minus

fun minus(other: ColorRGBa): ColorRGBa

opacify

Creates a copy of color with adjusted opacity

fun opacify(factor: Double): ColorRGBa

plus

fun plus(other: ColorRGBa): ColorRGBa

shade

Creates a copy of color with adjusted color

fun shade(factor: Double): ColorRGBa

times

fun times(factor: Double): ColorRGBa

toHSLa

fun toHSLa(): ColorHSLa

toHSVa

fun toHSVa(): ColorHSVa

toLABa

fun toLABa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLABa

toLCHABa

fun toLCHABa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLCHABa

toLCHUVa

fun toLCHUVa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLCHUVa

toLinear

Convert to linear RGB

fun toLinear(): ColorRGBa

toLUVa

fun toLUVa(ref: ColorXYZa = ColorXYZa.NEUTRAL): ColorLUVa

toRGBa

convert to ColorRGBa

fun toRGBa(): ColorRGBa

toSRGB

Convert to SRGB

fun toSRGB(): ColorRGBa

toXSLa

fun toXSLa(): ColorXSLa

toXSVa

fun toXSVa(): ColorXSVa

toXYZa

fun toXYZa(): ColorXYZa

Companion Object Functions

fromHex

fun fromHex(hex: Int): ColorRGBa
fun fromHex(hex: String): ColorRGBa

fromVector

Create a ColorRGBa object from a Vector3

fun fromVector(vector: Vector3, alpha: Double = 1.0): ColorRGBa

Create a ColorRGBa object from a Vector4

fun fromVector(vector: Vector4): ColorRGBa