color

.color base:{Color = Color(0, 0, 0)} \
red:{Int = base.red} \
green:{Int = base.green} \
blue:{Int = base.blue} \
alpha:{Number = base.alpha}
-> Color

Builds a color, either from scratch or from an existing one. Each given component replaces the corresponding one of base, while the others are kept. Without a base, unspecified components start from opaque black.

.color red:{66} green:{144} blue:{245}

Builds rgb(66, 144, 245).

.text {Faded} color:{.color {#4290F5} alpha:{0.5}}

Displays the text at half opacity.

.var {brand} {#4290F5}
.container background:{.brand::color alpha:{0.25}}

Derives a translucent variant of a stored color.

Return

the resulting color

Parameters

base
  • Optional

the color to start from. Opaque black if unset

red

red component, 0-255

green

green component, 0-255

blue

blue component, 0-255

alpha

alpha component, 0-1

Throws

if a component is out of range

Chaining

This function is designed to be chained with other function calls:
Color::color red:{Int} \
green:{Int} \
blue:{Int} \
alpha:{Number}
-> Color

Wiki page

color