Skip to main content

Module theme

Module theme 

Source
Expand description

Theme: the colours and scales of the UI and the chart.

A Theme is a plain value with public fields. Start from a preset (Theme::dark, the default, Theme::light or Theme::high_contrast), change the fields you need, and pass it to apply_to_egui, once at startup and again after every change.

use egui::Color32;
use egui_charts::theme::{Theme, apply_to_egui};

let mut theme = Theme::dark().with_accent(Color32::from_rgb(255, 120, 0));
theme.chart.candle_up = Color32::from_rgb(0, 160, 120);
apply_to_egui(ctx, &theme);

Structs§

ChartColors
Colours of the chart surface.
Radii
Corner radius scale, in points.
Spacing
Spacing scale, in points.
TextSizes
Font sizes, in points.
Theme
The colours and scales of the UI and the chart.
UiColors
Colours of the UI chrome.

Traits§

ThemeExt
Read the theme last passed to apply_to_egui.

Functions§

apply_to_egui
Apply theme to egui’s visuals and store it for ThemeExt::active_theme. Also install Roboto ahead of the application’s proportional fonts.
presets
Every preset with its name: “dark”, “light” and “high-contrast”.