Styling#

Themes, colors, colormaps, encodings and node shapes (aryagraph.style).

Themes#

Theme

A complete visual vocabulary.

get_theme

Resolve a theme name (light, dark, paper, blueprint) or pass a Theme through.

register_theme

Make theme available by name to every theme= argument.

Encodings#

By

Explicit encoding spec.

Legend

What a renderer needs to draw one legend block.

LegendEntry

Encoding shorthand#

aryagraph.style.scales.by(field: Any, kind: str | None = None, **options: Any) → By[source]#

Shorthand for By: by("pagerank", kind="log", palette="magma").

Colors and colormaps#

Colormap

A continuous color scale over [0, 1], interpolated in OKLab between stops.

parse

Parse a CSS color (hex, rgb()/rgba(), hsl()/hsla(), named, transparent) or an RGB(A) tuple of floats in [0, 1] into an RGBA float tuple.

to_hex

Canonical lowercase hex (#rrggbb or #rrggbbaa when translucent).

mix

Interpolate from c1 (t=0) to c2 (t=1) in OKLab (alpha linearly).

lighten

Raise OKLCH lightness by amount (0–1 scale), keeping hue and chroma.

darken

with_alpha

contrast_ratio

WCAG contrast ratio in [1, 21].

readable_on

Whichever of light / dark text contrasts more with background.

label_on

Text color for a short label set inside a solid colored mark.

Palettes#

colormap

Look up a colormap by name.

diverging

Two opposing hue arms through a neutral gray midpoint (equal steps per arm).

available_colormaps

Shapes#

Shape

Base class; subclasses implement path(), contains(), boundary().

get_shape

Text#

text_width

Estimated rendered width in pixels of a single line of text at font size.

wrap

Break text into lines no wider than max_width.

truncate

text, cut and suffixed with an ellipsis if it is wider than max_width.

is_rtl

True when text contains right-to-left script (Arabic, Persian, Hebrew…).