Skip to content

Color

Functions

lighten

luau
Color.lighten(c: Color3, amount: number): Color3

Raises the perceptual lightness of a Color3 by amount, working in Oklab so the shift looks uniform across hues. Pass a negative amount (or use Color.darken) to go darker.

Open Documentation

darken

luau
Color.darken(c: Color3, amount: number): Color3

Lowers the perceptual lightness of a Color3 by amount, working in Oklab so the shift looks uniform across hues. The inverse of Color.lighten.

Open Documentation

saturate

luau
Color.saturate(c: Color3, amount: number): Color3

Raises the chroma of a Color3 by amount (making it more vivid) while preserving its perceptual hue and lightness in Oklab. Achromatic colours have no hue to grow along and pass through unchanged.

Open Documentation

desaturate

luau
Color.desaturate(c: Color3, amount: number): Color3

Lowers the chroma of a Color3 by amount (washing it out) while preserving its perceptual hue and lightness in Oklab. The inverse of Color.saturate.

Open Documentation

rotateHue

luau
Color.rotateHue(c: Color3, degrees: number): Color3

Rotates the hue of a Color3 by degrees around the Oklab colour wheel, preserving chroma and lightness. degrees is in degrees (not turns); 360 is a full revolution and negative values rotate the other way.

Open Documentation

grayscale

luau
Color.grayscale(c: Color3): Color3

Strips all chroma from a Color3, returning the neutral grey of the same perceptual lightness in Oklab. A truer grey than averaging RGB channels.

Open Documentation

mix

luau
Color.mix(a: Color3, b: Color3, t: number): Color3

Perceptually blends two Color3s in Oklab, where t is the fraction from a (0) to b (1). Mixing through Oklab avoids the muddy midpoints of a raw RGB lerp. t is unclamped: values outside [0, 1] extrapolate, matching how Flux.spring and Flux.tween animate colour.

Open Documentation

fromTemperature

luau
Color.fromTemperature(kelvin: number): Color3

Returns the Color3 a blackbody glows at kelvin: warm orange around 2000, neutral near 6500, cool blue beyond. kelvin is clamped to the [1000, 40000] K range. Handy for warm/cool lighting tints.

Open Documentation

luminance

luau
Color.luminance(c: Color3): number

The WCAG relative luminance of a Color3, from 0 (black) to 1 (white). This is the perceived brightness used to compute Color.contrast, weighting green most and blue least.

Open Documentation

contrast

luau
Color.contrast(a: Color3, b: Color3): number

The WCAG contrast ratio between two Color3s, from 1 (identical) to 21 (black on white). The result is order-independent. WCAG asks for at least 4.5 for body text and 3 for large text.

Open Documentation

readable

luau
Color.readable(bg: Color3, dark: Color3?, light: Color3?): Color3

Picks whichever foreground Color3 reads more legibly on bg: the one with the higher WCAG contrast ratio. dark and light default to black and white; pass your own brand tints to keep on-brand text readable over any background.

Open Documentation

Oklab

fromLinear

luau
Color.Oklab.fromLinear(color: Color3): Vector3

Converts a Color3 in linear sRGB space to a Vector3 in Oklab space

toLinear

luau
Color.Oklab.toLinear(color: Vector3, clamped: boolean?): Color3

Converts a Vector3 in Oklab space to a Color3 in linear sRGB space.

fromHCL

luau
Color.Oklab.fromHCL(hcl: Vector3): Vector3

Converts a Vector3 in HCL space (hue in degrees) to a Vector3 in Oklab space

toHCL

luau
Color.Oklab.toHCL(lab: Vector3): Vector3

Converts a Vector3 in Oklab space to a Vector3 in HCL space (hue in degrees, [0, 360))

fromRGB

luau
Color.Oklab.fromRGB(rgb: Color3): Vector3

Converts a Color3 in sRGB space to a Vector3 in Oklab space

toRGB

luau
Color.Oklab.toRGB(lab: Vector3, clamped: boolean?): Color3

Converts a Vector3 in Oklab space to a Color3 in sRGB space

lighten

luau
Color.Oklab.lighten(lab: Vector3, amount: number): Vector3

Raises Oklab lightness by amount

darken

luau
Color.Oklab.darken(lab: Vector3, amount: number): Vector3

Lowers Oklab lightness by amount

saturate

luau
Color.Oklab.saturate(lab: Vector3, amount: number): Vector3

Raises chroma by amount, preserving hue and lightness

desaturate

luau
Color.Oklab.desaturate(lab: Vector3, amount: number): Vector3

Lowers chroma by amount, preserving hue and lightness

rotateHue

luau
Color.Oklab.rotateHue(lab: Vector3, degrees: number): Vector3

Rotates hue by degrees, preserving chroma and lightness.

grayscale

luau
Color.Oklab.grayscale(lab: Vector3): Vector3

Removes all chroma, preserving Oklab lightness.

mix

luau
Color.Oklab.mix(lab1: Vector3, lab2: Vector3, alpha: number): Vector3

Returns an Oklab Vector3 linearly interpolated between lab1 and lab2 by the given alpha. Equivalent to lab1:Lerp(lab2, alpha).

fromTemperature

luau
Color.Oklab.fromTemperature(kelvin: number): Vector3

Oklab colour of a blackbody at kelvin. (1000–40000 K)

sRGB

fromLinear

luau
Color.sRGB.fromLinear(color: Color3): Color3

Converts linear sRGB space to sRGB space

toLinear

luau
Color.sRGB.toLinear(color: Color3): Color3

Converts sRGB space to linear sRGB space