Skip to content
Shapemetry

Model - Color functions

Every function callable as Color.* inside an expression — an argument input, a parameter binding, a table cell. Pure: no side effects, no async.

FunctionReturnsDescriptionArgTypeMeaning
Color.alpha(color, value)stringCSS rgba() string with the given alpha — translucent fills/overlays.colorcolorhex color
valuenumberopacity 0..1
Color.contrast(background, dark, light)colorPick whichever of dark/light reads better on the background (WCAG contrast ratio) — self-adapting text color.backgroundcolorbackground hex color
darkcolordark candidate (default #111111)
lightcolorlight candidate (default #ffffff)
Color.darken(color, fraction)colorDarken toward black.colorcolorhex color
fractionnumber0..1 toward black (default 0.1)
Color.hsl(hue, saturation, lightness)colorBuild a hex color from hue/saturation/lightness — the parametric constructor (Color.hsl(index * 30, 0.7, 0.5)).huenumberdegrees, wraps 360
saturationnumber0..1 (default 0.7)
lightnessnumber0..1 (default 0.5)
Color.lighten(color, fraction)colorLighten toward white.colorcolorhex color
fractionnumber0..1 toward white (default 0.1)
Color.luminance(color)numberWCAG relative luminance 0 (black) .. 1 (white) — for conditionals (Color.luminance(brand) > 0.5).colorcolorhex color
Color.mix(from, to, fraction)colorBlend two hex colors.fromcolorfirst hex color
tocolorsecond hex color
fractionnumber0 = all from, 1 = all to (default 0.5)
Color.rgb(red, green, blue)colorBuild a hex color from RGB channels.rednumber0..255
greennumber0..255
bluenumber0..255
Color.rotate(color, degrees)colorRotate the hue — rotate(brand, 180) is the complement, ±30 gives analogous colors.colorcolorhex color
degreesnumberhue rotation in degrees, wraps (default 30)
Color.saturate(color, amount)colorScale saturation — negative desaturates, -1 is grayscale; grays stay gray.colorcolorhex color
amountnumber-1..1 multiplicative (-1 = grayscale, +1 = double; default 0.25)
Last updated: 📖 1 min readEdit on GitHub