egui_charts/tokens/resolved.rs
1//! The root [`DesignTokens`] struct and its spacing scale.
2
3use super::semantic::SemanticTokens;
4use super::sizing::{LayoutTokens, RoundingTokens, ShadowTokens, SizingTokens, StrokeTokens};
5
6/// Shared spacing, dimensions and color defaults for chart controls.
7///
8/// Access the global instance via [`DESIGN_TOKENS`](super::DESIGN_TOKENS).
9/// Contains default spacing, sizing, rounding, stroke widths, shadow parameters
10/// and semantic color tokens. UI colors and text, spacing and radius scales come
11/// from the applied `theme::Theme` (requires `widget`).
12#[derive(Clone, Debug)]
13pub struct DesignTokens {
14 /// Spacing defaults.
15 pub spacing: SpacingTokens,
16 /// Sizing defaults.
17 pub sizing: SizingTokens,
18 /// Rounding defaults.
19 pub rounding: RoundingTokens,
20 /// Stroke defaults.
21 pub stroke: StrokeTokens,
22 /// Shadow defaults.
23 pub shadow: ShadowTokens,
24 /// Layout defaults.
25 pub layout: LayoutTokens,
26 /// Semantic defaults.
27 pub semantic: SemanticTokens,
28}
29
30/// Spacing tokens defining consistent gaps, padding, and margins.
31///
32/// Values are in egui logical points. Use `panel_gap` and `section_lg`
33/// for panel and section spacing, or the graduated sizes for control layout.
34#[derive(Clone, Debug)]
35pub struct SpacingTokens {
36 /// Extra small, in egui logical points.
37 pub xs: f32,
38 /// Small, in egui logical points.
39 pub sm: f32,
40 /// Medium, in egui logical points.
41 pub md: f32,
42 /// Large, in egui logical points.
43 pub lg: f32,
44 /// Extra large, in egui logical points.
45 pub xl: f32,
46 /// Double extra large, in egui logical points.
47 pub xxl: f32,
48 /// Triple extra large, in egui logical points.
49 pub xxxl: f32,
50 /// Hairline, in egui logical points.
51 pub hairline: f32,
52 /// Section large, in egui logical points.
53 pub section_lg: f32,
54 /// Panel gap, in egui logical points.
55 pub panel_gap: f32,
56}