Build an RGBA color from HSV components.
Hue wraps modulo 1, so hsv(1.1, s, v) is the same hue as hsv(0.1, s, v).
let hsv = |h, s, v, a = 1| ...
h | hue wrapped over [0, 1] |
s | saturation in [0, 1] |
v | value in [0, 1] |
a | alpha component in [0, 1], default 1 |
let palette = [hsv(0.55, 0.7, 0.9), hsv(0.85, 0.5, 0.9)]
Return a color with the same RGB channels and a new alpha component.
This is an operator so it composes naturally inside styling, for example fill{alpha{0.16} BLUE}.
let alpha = operator |target, a| ...
imagedoc-color-alpha-1.mcl
mesh disk = fill{alpha{0.16} BLUE} Circle(1)
Warm red RGBA color constant.
let RED = [0.9, 0.3, 0.2, 1]
imagedoc-color-red-1.mcl
mesh dot = fill{RED} Circle(0.4)
Warm orange RGBA color constant.
let ORANGE = [1.0, 0.7, 0.2, 1]
Bright yellow RGBA color constant.
let YELLOW = [1.0, 1.0, 0.0, 1]
Green RGBA color constant.
let GREEN = [0.2, 0.6, 0.3, 1]
Teal RGBA color constant.
let TEAL = [0.2, 0.7, 0.7, 1]
Cyan RGBA color constant.
let CYAN = [0.1, 0.7, 0.9, 1]
Blue RGBA color constant.
let BLUE = [0.1, 0.4, 0.6, 1]
Dark blue RGBA color constant.
let NAVY = [0.05, 0.1, 0.4, 1]
Purple RGBA color constant.
let PURPLE = [0.6, 0.4, 0.7, 1]
Magenta RGBA color constant.
let MAGENTA = [0.9, 0.2, 0.7, 1]
Pink RGBA color constant.
let PINK = [1.0, 0.6, 0.7, 1]
Brown RGBA color constant.
let BROWN = [0.5, 0.3, 0.2, 1]
White RGBA color constant.
let WHITE = [1.0, 1.0, 1.0, 1]
Light gray RGBA color constant.
let LIGHT_GRAY = [0.7, 0.7, 0.7, 1]
Middle gray RGBA color constant.
let GRAY = [0.5, 0.5, 0.5, 1]
Dark gray RGBA color constant.
let DARK_GRAY = [0.3, 0.3, 0.3, 1]
Black RGBA color constant.
let BLACK = [0.0, 0.0, 0.0, 1]
Fully transparent black, useful for invisible fills and empty strokes.
let CLEAR = [0.0, 0.0, 0.0, 0]
imagedoc-color-clear-1.mcl
mesh ring = fill{CLEAR} stroke{CYAN} Circle(1)
Build an RGBA color from red, green, blue, and optional alpha components.
let rgb = |r, g, b, a = 1| [r, g, b, a]
r | red component in [0, 1] |
g | green component in [0, 1] |
b | blue component in [0, 1] |
a | alpha component in [0, 1], default 1 |
mesh item = fill{rgb(0.2, 0.7, 0.9, 0.25)} Circle(1)
Build a gray RGBA color from one luminance value and optional alpha.
let gray_shade = |v, a = 1| [v, v, v, a]
v | gray value in [0, 1] |
a | alpha component in [0, 1], default 1 |
mesh label = color{gray_shade(0.25)} Text("dim")