neu_draw.colors¶
Colour normalisation and assignment, as RGBA tuples. No plotting or colormap library is required.
Names resolve from a small table: matplotlib’s single-letter shorthands, basic names and
the tab: colours. Any other name is passed to the cmap library if it is installed,
which knows the full CSS vocabulary.
Attributes¶
Functions¶
|
One colour per name: explicit where given, otherwise cycling the palette. |
|
Normalise a colour to |
Module Contents¶
- neu_draw.colors.assign_colors(names: Iterable[Hashable], explicit: Mapping[Hashable, Any] | Any | None = None, palette: Sequence[Any] | None = None) dict[Hashable, RGBA]¶
One colour per name: explicit where given, otherwise cycling the palette.
explicitmay be a mapping, a single colour for everything, or a sequence to use as the palette. Palette position depends only on the names without an explicit colour, so fixing one body’s colour does not change the others’.
- neu_draw.colors.to_rgba(color: Any, alpha: float | None = None) RGBA¶
Normalise a colour to
(r, g, b, a)floats in[0, 1].Accepts a name,
#rgb/#rrggbb/#rrggbbaa, or a 3- or 4-sequence of floats in[0, 1].alphaoverrides whatever the colour carried.
- neu_draw.colors.QUALITATIVE: tuple[RGBA, ...] = ((0.1216, 0.4667, 0.7059, 1.0), (1.0, 0.498, 0.0549, 1.0), (0.1725, 0.6275, 0.1725, 1.0),...¶
- neu_draw.colors.RGBA¶