Skip to main content

Module style

Module style 

Source
Expand description

Shared styling: a color-blind-safe default palette and small helpers for building ShapeStyles, used by every chart type so the crate’s output is visually consistent.

The default palette is the Okabe–Ito qualitative palette, designed to be distinguishable under the common forms of color-vision deficiency.

Okabe, M. & Ito, K. (2008). Color Universal Design (CUD): How to make figures and presentations that are friendly to colorblind people. https://jfly.uni-koeln.de/color/

Constants§

DEFAULT_FONT
Default label / axis font family used across the crate’s examples.
DEFAULT_FONT_SIZE
Default font size (points) for legend and annotation text.
OKABE_ITO
The eight Okabe–Ito colors as (r, g, b) triples, in the recommended order.

Functions§

fill_style
A solid-fill ShapeStyle of the given color (filled = true).
palette_color
Returns the i-th palette color, cycling through the seven non-black Okabe–Ito hues. Deterministic, so the k-th series always gets the same color across every chart type.
rgba
Convenience: a fully-specified RGBAColor with explicit alpha.
stroke_style
A stroked (outline) ShapeStyle of the given color and width (filled = false).
translucent_fill
A translucent fill built from color at the given alpha (0.0–1.0).