cottax.consumers.visualization.style module¶
How every drawing is coloured and marked: a Style, and the three shipped (STYLES).
- type Pair = tuple[str, str]¶
(fill, stroke).
- mix(colour: str, towards: str, t: float)[source]¶
colour taken t of the way to towards, per channel in sRGB.
- Return type:
str
- class Ground[source]¶
Bases:
FrozenThe ground a style is drawn on, as the rule taking a category’s colour – its (fill, stroke) on a light ground, Kind.colour – to the pair drawn on this one. A category is coloured once, by its language, and every ground draws it.
- abstract property scheme: str¶
‘light’ or ‘dark’.
- Type:
The CSS color-scheme it is
- class Light[source]¶
Bases:
GroundA light ground: the pair as the category gives it.
- property scheme: str¶
‘light’ or ‘dark’.
- Type:
The CSS color-scheme it is
- class Dark(fill_lightness: float, fill_chroma: float, stroke_lightness: float, stroke_chroma: float)[source]¶
Bases:
GroundA dark ground: each colour keeps its hue (in Oklab), takes a lightness of its own and its chroma scaled – the fill dark and muted, the stroke light, so a hexagon reads on the ground and its contour on the hexagon.
- fill_lightness: float¶
- fill_chroma: float¶
- stroke_lightness: float¶
- stroke_chroma: float¶
- property scheme: str¶
‘light’ or ‘dark’.
- Type:
The CSS color-scheme it is
- class Style(name: str, surface: str, ink: str, muted: str, model: Pair, variable: Pair, variable_ink: str, boundary: Pair, edge: str, chip: Pair, ground: Ground, stated: Pair, unanswered: str, bands: tuple[str, ...], band_stroke: str, dashed: bool, run_ring: str | None, undriven: str, tint: float, driven_tint: float, cut_em: float, bold: bool, font: str | None, ring_gap: float, nest_em: float, ring_radius_em: float, groups: tuple[str, ...])[source]¶
Bases:
FrozenThe colours and marks of every drawing in this package. A problem’s hue is its category’s; value is structure; fill and contour are how far a problem is decided.
surface is the ground, ink a box’s label, muted a boundary label or a key entry. model, variable and boundary are (fill, stroke) for a box that runs, a coupling and the two boxes standing for the world outside; variable_ink a variable’s name. edge a coupling line. chip is a condition slot’s (fill, stroke), drawn translucent over its problem.
A category’s colour is its own (Kind.colour), and ground paints it (paint): the hexagon of a problem of that category, and the contour of the ring it answers. A renderer holding a category’s name takes the colour from its struct. stated is a condition that determines nothing and whose type is unknown; one whose type is known is drawn hollow in that type’s stroke. unanswered is the contour of a ring no driver answers (a bare cycle, or several problems with nothing nested).
bands fills a solve ring, one entry per nesting depth (cycling); empty draws the ring as a contour alone. band_stroke is the contour of a band’s key sample, dashed whether a solve ring’s contour is dashed. run_ring is the contour of a block merely run in order, None to draw none.
undriven says how a problem without a driver is drawn: ‘tint’ fills it tint of the way to its type’s fill (driven_tint once driven) and cuts its contour, and a ring nothing answers, open by cut_em in the middle of top and bottom; ‘solid’ draws every problem alike. bold sets every name in a heavier weight. font is a CSS family list, None for the renderer’s own. ring_gap is a solve ring’s clearance as a fraction of the gap between two boxes, nest_em what a nested ring and a driver’s chevron stand off a ring (in ems, floored at that clearance), ring_radius_em a ring’s corner.
groups is the categorical palette a drawing colours groups of nodes with; it keeps clear of the categories’ hues.
- name: str¶
- surface: str¶
- ink: str¶
- muted: str¶
- variable_ink: str¶
- edge: str¶
- unanswered: str¶
- bands: tuple[str, ...]¶
- band_stroke: str¶
- dashed: bool¶
- run_ring: str | None¶
- undriven: str¶
- tint: float¶
- driven_tint: float¶
- cut_em: float¶
- bold: bool¶
- font: str | None¶
- ring_gap: float¶
- nest_em: float¶
- ring_radius_em: float¶
- groups: tuple[str, ...]¶
- paint(colour: Pair | None)[source]¶
The (fill, stroke) of a problem of a category coloured colour, or stated’s for none.
- Return type:
- fill(colour: Pair | None, driven: bool)[source]¶
What a problem of a category coloured colour is filled with, driven or not; stated’s grey, tinted as any, for none.
- Return type:
str
- band(depth: int)[source]¶
The fill of a solve ring at depth, or None for a contour alone.
- Return type:
str|None
- property cuts: bool¶
Whether a problem without a driver has its contour cut open.
- GROUP_HUES = ('#4c78a8', '#f58518', '#3fa7b8', '#e45756', '#cc79a7', '#5c9ecf', '#f2a35e', '#ff9da6', '#8ab6d6', '#bab0ac', '#d98c8c', '#6b8fb8')¶
Mid-luminance, readable on white and on black, and clear of green, ocher and violet, which a problem’s category may wear.
- TERRACOTTA = Style(name='terracotta', surface='#ffffff', ink='#3d3330', muted='#7d716c', model=('#f8ece7', '#b5583f'), variable=('#e9f0f6', '#5b83a6'), variable_ink='#39617f', boundary=('#f1ece9', '#8a7d76'), edge='#b9aea9', chip=('#fff', '#5e5e5e'), ground=Light(), stated=('#d9d9d9', '#5e5e5e'), unanswered='#9d9d9d', bands=('#f0ede8', '#e5dfd3', '#d9d1c1'), band_stroke='#bdb4a9', dashed=False, run_ring=None, undriven='tint', tint=0.65, driven_tint=0.8, cut_em=0.5, bold=False, font=None, ring_gap=1.0, nest_em=0.7, ring_radius_em=0.3, groups=('#4c78a8', '#f58518', '#3fa7b8', '#e45756', '#cc79a7', '#5c9ecf', '#f2a35e', '#ff9da6', '#8ab6d6', '#bab0ac', '#d98c8c', '#6b8fb8'))¶
terracotta models and steel variables, a solve a neutral band ringed in its driver’s hue, a problem without a driver tinted with its contour cut open.
- Type:
The default
- PYXDSM = Style(name='pyxdsm', surface='#ffffff', ink='#1a1a1a', muted='#555555', model=('#e4f2e0', '#3f9c35'), variable=('#f3ddd0', '#c1704f'), variable_ink='#8a3a1f', boundary=('#eef1f5', '#8c9bb0'), edge='#8a8a8a', chip=('#fff', '#5e5e5e'), ground=Light(), stated=('#f1f2f4', '#8c9bb0'), unanswered='#8c9bb0', bands=(), band_stroke='#e08a2b', dashed=True, run_ring='#8c9bb0', undriven='solid', tint=1.0, driven_tint=1.0, cut_em=0.0, bold=True, font=None, ring_gap=0.5, nest_em=0.0, ring_radius_em=0.6, groups=('#4c78a8', '#f58518', '#3fa7b8', '#e45756', '#cc79a7', '#5c9ecf', '#f2a35e', '#ff9da6', '#8ab6d6', '#bab0ac', '#d98c8c', '#6b8fb8'))¶
rings as dashed contours in their driver’s hue, every problem drawn alike, in its category’s own colour.
- Type:
pyXDSM’s green / orange / white, the convention in that literature
- DARK = Style(name='dark', surface='#1a1a19', ink='#f0f0f0', muted='#aaaaaa', model=('#4a2c22', '#d9795c'), variable=('#1f3347', '#6f9cc4'), variable_ink='#a9c8e4', boundary=('#2b2f33', '#8c959e'), edge='#6b6a65', chip=('#1a1a19', '#aaaaaa'), ground=Dark(), stated=('#333333', '#a0a0a0'), unanswered='#6e6e6e', bands=('#242322', '#2e2c2a', '#383532'), band_stroke='#6e6a66', dashed=False, run_ring=None, undriven='tint', tint=0.65, driven_tint=0.8, cut_em=0.5, bold=False, font=None, ring_gap=1.0, nest_em=0.7, ring_radius_em=0.3, groups=('#4c78a8', '#f58518', '#3fa7b8', '#e45756', '#cc79a7', '#5c9ecf', '#f2a35e', '#ff9da6', '#8ab6d6', '#bab0ac', '#d98c8c', '#6b8fb8'))¶
TERRACOTTA’s reading on a dark ground, each category’s colour relit for it.
- STYLES: Mapping[str, Style] = {'dark': Style(name='dark', surface='#1a1a19', ink='#f0f0f0', muted='#aaaaaa', model=('#4a2c22', '#d9795c'), variable=('#1f3347', '#6f9cc4'), variable_ink='#a9c8e4', boundary=('#2b2f33', '#8c959e'), edge='#6b6a65', chip=('#1a1a19', '#aaaaaa'), ground=Dark(), stated=('#333333', '#a0a0a0'), unanswered='#6e6e6e', bands=('#242322', '#2e2c2a', '#383532'), band_stroke='#6e6a66', dashed=False, run_ring=None, undriven='tint', tint=0.65, driven_tint=0.8, cut_em=0.5, bold=False, font=None, ring_gap=1.0, nest_em=0.7, ring_radius_em=0.3, groups=('#4c78a8', '#f58518', '#3fa7b8', '#e45756', '#cc79a7', '#5c9ecf', '#f2a35e', '#ff9da6', '#8ab6d6', '#bab0ac', '#d98c8c', '#6b8fb8')), 'pyxdsm': Style(name='pyxdsm', surface='#ffffff', ink='#1a1a1a', muted='#555555', model=('#e4f2e0', '#3f9c35'), variable=('#f3ddd0', '#c1704f'), variable_ink='#8a3a1f', boundary=('#eef1f5', '#8c9bb0'), edge='#8a8a8a', chip=('#fff', '#5e5e5e'), ground=Light(), stated=('#f1f2f4', '#8c9bb0'), unanswered='#8c9bb0', bands=(), band_stroke='#e08a2b', dashed=True, run_ring='#8c9bb0', undriven='solid', tint=1.0, driven_tint=1.0, cut_em=0.0, bold=True, font=None, ring_gap=0.5, nest_em=0.0, ring_radius_em=0.6, groups=('#4c78a8', '#f58518', '#3fa7b8', '#e45756', '#cc79a7', '#5c9ecf', '#f2a35e', '#ff9da6', '#8ab6d6', '#bab0ac', '#d98c8c', '#6b8fb8')), 'terracotta': Style(name='terracotta', surface='#ffffff', ink='#3d3330', muted='#7d716c', model=('#f8ece7', '#b5583f'), variable=('#e9f0f6', '#5b83a6'), variable_ink='#39617f', boundary=('#f1ece9', '#8a7d76'), edge='#b9aea9', chip=('#fff', '#5e5e5e'), ground=Light(), stated=('#d9d9d9', '#5e5e5e'), unanswered='#9d9d9d', bands=('#f0ede8', '#e5dfd3', '#d9d1c1'), band_stroke='#bdb4a9', dashed=False, run_ring=None, undriven='tint', tint=0.65, driven_tint=0.8, cut_em=0.5, bold=False, font=None, ring_gap=1.0, nest_em=0.7, ring_radius_em=0.3, groups=('#4c78a8', '#f58518', '#3fa7b8', '#e45756', '#cc79a7', '#5c9ecf', '#f2a35e', '#ff9da6', '#8ab6d6', '#bab0ac', '#d98c8c', '#6b8fb8'))}¶
The styles by name, for any drawing’s style.