Expand description
Application-wide shape, density, and type scale: control heights, row heights, corner radii, border width, and text size.
Colors come from the crate::theme; this module holds everything else that makes
the workbench look compact, roomy, sharp, or round. Install a WorkbenchStyle
once with set (it survives theme changes) and every component reads it with
get. The default reproduces the shell exactly, pixel for pixel.
use crisol_ui_kit::style::{self, Density, WorkbenchStyle};
style::set(&ctx, WorkbenchStyle {
density: Density::Compact,
control_radius: 3,
..WorkbenchStyle::default()
});
assert_eq!(style::get(&ctx).control_height(), 26.0);The window chrome (title bar, tab strip, status bar) keeps its fixed heights from
crate::metrics: it matches the platform’s window decorations and the hit areas
of the window controls. Its radii, borders, and text still follow the style.
Components never hard-code a radius, border width, or font size: they ask the
style (WorkbenchStyle::item, WorkbenchStyle::border,
WorkbenchStyle::font, …). cargo xtask check rejects literal radii and font
sizes outside this module, so a custom style reaches every pixel.
Structs§
- Workbench
Style - Shape and density shared by every component.
Enums§
- Density
- How much vertical room controls and rows take.
Constants§
- TYPE_
SCALE - The reference type scale installed into egui’s text styles (before
WorkbenchStyle::text_scale).