Theme¶
The palette the workbench paints plotly, pyvista, xterm and Monaco with, and the colormap catalogue its pickers offer.
femforge_workbench.theme
¶
The palette read from the dist's theme.json, painting plotly, pyvista, xterm and Monaco in the stylesheet's colours.
Classes:
-
Scheme–The two colour schemes theme.json carries.
-
Token–The stylesheet tokens the palette reads.
-
Section–The non-scheme sections of theme.json.
-
Font–The font stacks theme.json names.
-
Tokens–What theme.json carries: the colours of each scheme, the metrics in CSS pixels and the font stacks.
-
Metrics–The type sizes and chrome heights of the stylesheet, in CSS pixels.
-
Tones–The interaction colours derived from a palette, as hex.
-
Palette–The colours the panels share, read from one scheme of the tokens.
Functions:
-
rgb–The channels of a CSS colour written as a hex triplet, rgb()/rgba(), or white/black.
-
hex_color–The colour as an upper-case hex triplet, the form pyvista takes.
-
mix–The hex colour
fractionof the way fromontotocolor. -
luminance–The perceived brightness of a colour on the 0-255 scale.
-
rotate_hue–The colour with its hue rotated by a fraction of the wheel, as a hex triplet.
-
template_json–A registered plotly template (the default when unnamed) as plain JSON.
-
section–The nested object under
key, empty when absent. -
text–The string under
key, else the fallback. -
load_tokens–The tokens of the built dist; a missing dist names the build command.
Tokens
dataclass
¶
Tokens(colors: Mapping[str, Mapping[str, str]], metrics: Mapping[str, float], fonts: Mapping[str, str])
What theme.json carries: the colours of each scheme, the metrics in CSS pixels and the font stacks.
Methods:
-
from_json–Reads the tokens from theme.json's document.
from_json
classmethod
¶
Reads the tokens from theme.json's document.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
Metrics
dataclass
¶
Metrics(size_body: float, size_label: float, bar_height: float, tab_height: float, space: float, row_height: float)
The type sizes and chrome heights of the stylesheet, in CSS pixels.
Methods:
-
from_tokens–Reads the metrics from the tokens, which name each field in kebab case.
from_tokens
classmethod
¶
Reads the metrics from the tokens, which name each field in kebab case.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
Tones
dataclass
¶
The interaction colours derived from a palette, as hex.
Palette
dataclass
¶
Palette(paper: str, plot: str, text: str, grid: str, accent: str, muted: str, chart: tuple[str, ...], dark: bool, metrics: Metrics, font: str, mono: str)
The colours the panels share, read from one scheme of the tokens.
Methods:
-
from_tokens–The palette of one scheme of the tokens.
-
load–The dist's palette in one scheme.
-
with_accent–The dist's palette with an accent of the caller's own.
-
colorway–The chart colours, then hues rotated evenly from the accent for the rest.
-
tones–The derived interaction colours: a raised surface and text that reads on the accent.
-
plotly_template–The base template (plotly_dark or plotly_white by scheme) repainted in this palette, at the label size, with the top margin a titleless figure needs.
-
install–Registers this palette's plotly template as the default, so every figure built afterwards is painted in it.
-
xterm_theme–The xterm ITheme colours.
Attributes:
-
is_dark(bool) –Whether the palette paints the dark scheme.
-
monaco_theme(str) –The built-in Monaco theme matching the scheme.
from_tokens
classmethod
¶
The palette of one scheme of the tokens.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
load
classmethod
¶
with_accent
classmethod
¶
The dist's palette with an accent of the caller's own.
colorway
¶
The chart colours, then hues rotated evenly from the accent for the rest.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
tones
¶
tones() -> Tones
The derived interaction colours: a raised surface and text that reads on the accent.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
plotly_template
¶
plotly_template(base: str | None = None) -> Json
The base template (plotly_dark or plotly_white by scheme) repainted in this palette, at the label size, with the top margin a titleless figure needs.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
install
¶
Registers this palette's plotly template as the default, so every figure built afterwards is painted in it.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
xterm_theme
¶
The xterm ITheme colours.
rgb
¶
The channels of a CSS colour written as a hex triplet, rgb()/rgba(), or white/black.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
hex_color
¶
The colour as an upper-case hex triplet, the form pyvista takes.
mix
¶
The hex colour fraction of the way from onto to color.
Parameters:
-
color(str) –The colour at a fraction of 1.
-
onto(str) –The colour at a fraction of 0.
-
fraction(float) –How far from
ontotowardcolor, from 0 to 1.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
luminance
¶
The perceived brightness of a colour on the 0-255 scale.
rotate_hue
¶
The colour with its hue rotated by a fraction of the wheel, as a hex triplet.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
template_json
¶
template_json(name: str | None = None) -> Json
A registered plotly template (the default when unnamed) as plain JSON.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
section
¶
The nested object under key, empty when absent.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
text
¶
The string under key, else the fallback.
Parameters:
-
source(Mapping[str, object]) –The JSON object to read.
-
key(str) –The key to read.
-
fallback(str) –The string returned when the value is missing or not a string.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
load_tokens
cached
¶
load_tokens() -> Tokens
The tokens of the built dist; a missing dist names the build command.
Source code in packages/femforge-workbench/src/femforge_workbench/theme.py
femforge_workbench.colormaps
¶
The colormap catalogue the field viewer's pickers offer, by type, with the favorites listed first.
Classes:
-
ColormapType–Enumeration of colormap types.
-
Colormap–One catalogue entry: its type, the name pyvista resolves and the sentence-case label the pickers show.
Attributes:
FAVORITES
module-attribute
¶
FAVORITES: tuple[str, ...] = ('viridis', 'haline', 'batlow', 'inferno', 'Black-Body Radiation', 'coolwarm', 'vik', 'Fast', 'turbo')
Suggested starting maps, listed first in the colormap pickers.
Colormap
¶
Bases: NamedTuple
One catalogue entry: its type, the name pyvista resolves and the sentence-case label the pickers show.