Every scheme implements the Scheme attribute: given an index nth, it returns the n-th color of the series. Schemes are infinite — they wrap, alternate or step further with every index — so a consumer decides how many colors it needs.
Declared as Color2
The source declares scheme fields as Color2. This page reproduces the declared types verbatim; Color2 is not defined in colors.
"Invalid scheme type" — the value is not a member of SchemeLike.
prepend
`schemes/scheme.zirr:227`
fnprepend(c: Color2, s: @Scheme) -> @Scheme
Puts a fixed color in front of an existing scheme. Index 0 yields c, every further index nth yields s.color(nth - 1). Useful for layered surfaces and text, where the first color is fixed and the rest is derived.
A constant color scheme always returns colors from a predefined list. When the number of requested colors exceeds the number of colors in the list, it wraps around to the beginning of the list.
An analogous color scheme generates colors adjacent to the base color on the color wheel. The distance parameter controls how far apart the colors are. This creates a harmonious color scheme.
A monochromatic color scheme generates colors by varying the lightness of a single base color. This creates a cohesive and visually appealing color scheme. Brighter and darker shades are produced alternating.
A shade color scheme generates colors by reducing the lightness of a single base color. This creates a cohesive and visually appealing color scheme with progressively darker shades.
A tint color scheme generates colors by increasing the lightness of a single base color. This creates a cohesive and visually appealing color scheme with progressively lighter tints.
@Scheme(fn(s, nth) { tone(s.base, s.delta* nth) })
data Tone {
base: Color2
delta: maths.Fraction
}
A tone color scheme generates colors by adding gray to a single base color. This creates a cohesive and visually appealing color scheme with progressively more muted tones.
A mix color scheme generates colors by blending a base color with a target color. The ratio parameter controls the blend between the two colors. This creates a smooth transition between the base and target colors. This is useful for creating gradients, color transitions or to simulate opacity.
A golden spiral color scheme generates colors based on the golden angle (approximately 137.5 degrees). This creates a visually appealing and naturally balanced color scheme.
Fields
Field
Type
Description
base
Color2
The color returned at index 0; supplies the saturation for all others.
scale
maths.Fraction
Controls how quickly the lightness grows along the spiral.
@Scheme(fn(s, nth) { … })
data Rainbow {
steps: Int
saturation: maths.Fraction
lightness: maths.Fraction
}
A rainbow color scheme generates colors that span the entire spectrum of the color wheel. This creates a vibrant and diverse color scheme. Colors are generated by evenly distributing hues around the color wheel.
Fields
Field
Type
Description
steps
Int
Number of colors per full rotation.
saturation
maths.Fraction
Saturation shared by all colors.
lightness
maths.Fraction
Lightness shared by all colors.
Series
nth
Hue
any
nth * 360 / steps
See also
Colors — the color model and manipulation primitives.
Maths — the Degree and Fraction wrappers used by every scheme.