ChartTheme

Documentation for eth_defi.vault_report.theme.ChartTheme Python class.

class ChartTheme

Bases: object

Colours for report charts, panel frames and hero images.

Colours are CSS strings, #rrggbb unless noted, because Plotly takes them as is. Pillow code converts them, see eth_defi.vault_report.charts.to_rgba() and the branding helpers, so members that Pillow draws with must stay #rrggbb.

Attributes summary

name

Theme name, dark or light.

page_background

Page colour behind a panel: the background of the hero images, on which the ranking card sits

surface

Chart panel colour.

text

Titles and prominent labels

muted_text

Axis labels and secondary text

axis

Axis lines, zero lines and the panel footer rule

grid

Grid lines; a translucent rgba() on the dark theme, so it is used by Plotly only

series_colours

Categorical series colours in fixed assignment order.

positive

Positive values and the brand accent: gains, above-T-bill averages and the hero returns

negative

Negative values: losses and outflows

benchmark

US Treasury bill reference lines; amber, so the risk-free rate stands apart from the series colours

neutral

Low-emphasis neutral for the summed "Other" group of the TVL and risk and return charts

glow

Top-left panel glow colour, RGBA 0-255.

Methods summary

__init__(name, page_background, surface, ...)

name: str

Theme name, dark or light. Also selects the logo variants: the brand logo PNG, logo-horizontal-ai-{name}.png, and the protocol logo for this background, see eth_defi.vault_report.logos.load_protocol_logo_path()

page_background: str

Page colour behind a panel: the background of the hero images, on which the ranking card sits

surface: str

Chart panel colour. Plotly figures are styled with it but rendered transparent, so the panel’s own surface and glow show through, see eth_defi.vault_report.charts.render_figure_png()

text: str

Titles and prominent labels

muted_text: str

Axis labels and secondary text

axis: str

Axis lines, zero lines and the panel footer rule

grid: str

Grid lines; a translucent rgba() on the dark theme, so it is used by Plotly only

series_colours: tuple[str, ...]

Categorical series colours in fixed assignment order. Charts assign them by rank, so the length caps how many vaults or groups one chart can show; the order is the one checked for colour vision deficiency, so do not reorder or subset it except from the start

positive: str

Positive values and the brand accent: gains, above-T-bill averages and the hero returns

negative: str

Negative values: losses and outflows

benchmark: str

US Treasury bill reference lines; amber, so the risk-free rate stands apart from the series colours

neutral: str

Low-emphasis neutral for the summed “Other” group of the TVL and risk and return charts

glow: tuple[int, int, int, int]

Top-left panel glow colour, RGBA 0-255. The low alpha keeps it a hint of the website’s radial gradient after the Gaussian blur, see eth_defi.vault_report.branding

__init__(name, page_background, surface, text, muted_text, axis, grid, series_colours, positive, negative, benchmark, neutral, glow)
Parameters
Return type

None