Color
Functions
lighten
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.
darken
Lowers the perceptual lightness of a Color3 by amount, working in Oklab so the shift looks uniform across hues. The inverse of Color.lighten.
saturate
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.
desaturate
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.
rotateHue
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.
grayscale
Strips all chroma from a Color3, returning the neutral grey of the same perceptual lightness in Oklab. A truer grey than averaging RGB channels.
mix
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.
fromTemperature
Color.fromTemperature(kelvin: number): Color3Returns 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.
luminance
Color.luminance(c: Color3): numberThe 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.
contrast
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.
readable
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.
Oklab
fromLinear
Converts a Color3 in linear sRGB space to a Vector3 in Oklab space
toLinear
Converts a Vector3 in Oklab space to a Color3 in linear sRGB space.
fromHCL
Converts a Vector3 in HCL space (hue in degrees) to a Vector3 in Oklab space
toHCL
Converts a Vector3 in Oklab space to a Vector3 in HCL space (hue in degrees, [0, 360))
fromRGB
Converts a Color3 in sRGB space to a Vector3 in Oklab space
toRGB
Converts a Vector3 in Oklab space to a Color3 in sRGB space
lighten
Raises Oklab lightness by amount
darken
Lowers Oklab lightness by amount
saturate
Raises chroma by amount, preserving hue and lightness
desaturate
Lowers chroma by amount, preserving hue and lightness
rotateHue
Rotates hue by degrees, preserving chroma and lightness.
grayscale
Removes all chroma, preserving Oklab lightness.
mix
Returns an Oklab Vector3 linearly interpolated between lab1 and lab2 by the given alpha. Equivalent to lab1:Lerp(lab2, alpha).
fromTemperature
Color.Oklab.fromTemperature(kelvin: number): Vector3Oklab colour of a blackbody at kelvin. (1000–40000 K)
sRGB
fromLinear
Converts linear sRGB space to sRGB space
toLinear
Converts sRGB space to linear sRGB space