Skip to main content

Module palette

Module palette 

Source

Structs§

BaseIter
An iterator over the variants of Base
Palette
The 16 concrete colors a renderer draws from. Held by each Renderer backend so a SwatchColor lookup can happen at draw time. Built by one of the named base16 scheme constructors; the active scheme is chosen by the user’s preferences.
PaletteStroke
A stroke described by a world-space width plus a Swatch — a width and a colour, before either has a unit or a value. The renderer resolves the swatch to a color (and scales the width by zoom) at draw time. Construct from a (width, Base) or (width, Swatch) tuple, which wraps the literal width as a WorldPx; use PaletteStroke::NONE for no stroke.
Swatch
A palette color: one of the 16 Base slots, dimmed by an alpha multiplier. base == None resolves to a fully transparent color (the canvas’s “draw nothing” color). This is the single color type at the Renderer interface — it keeps the API tied to the palette instead of letting arbitrary Colors proliferate. Construct a fully-opaque swatch from a Base via Base.into(); use Swatch::faded for an overlay tint and Swatch::TRANSPARENT for nothing.

Enums§

Base
One of the 16 base colors of a Palette. B00..B07 are the monochrome shades (darkest background to lightest foreground); B08..B0F are the accent colors. This is the base16 convention.
Luminance
Which end of the light/dark axis a scheme sits on — the parameter form of is_dark, so a palette constructor reads Luminance::Dark, not true.
Saturation
Whether the canvas draws in its own colors or drained of them.

Functions§

luma 🔒
Rec. 601 luma — the grey a color drains toward, so a drained palette keeps the light/dark contrast the scheme was built with.
rgb 🔒