Skip to main content

Crate egui_pop

Crate egui_pop 

Source
Expand description

egui-pop: themable, accessible, agent-drivable components for egui.

The facade over the egui-pop crates: an application framework (App, plugins, commands with their keys, menus and palette, zones and a docking workbench, dialogs, toasts, settings, an undo history, a debug bridge an agent can drive) and parts usable on their own (design tokens and themes, visual kits, widgets, the image viewport, data views, editors). What is stable and what is experimental is in the README and docs/stability.md; experimental crates, modules and items say so in a warning block in their documentation; what works without App is in the guide’s “Using parts without App”.

The smallest start: themes are DTCG token files (see tokens) in three tiers (palette, roles, components), composed from a base theme (dark, light, high contrast), a density, an accent and overrides, and turned into egui’s own style so egui’s widgets and other crates’ widgets match. Custom widgets read the typed theme::Tokens from the context.

use egui_pop::theme::{self, Density, ThemeSpec};

let ctx = egui::Context::default();
// At start-up, or whenever the user picks another theme:
let tokens = theme::install(
    &ctx,
    &ThemeSpec::new("pop-dark").density(Density::Compact).accent("blue"),
);
assert!(tokens.resolved().problems().is_empty());

// Then draw as usual: egui's widgets use the theme, custom painting
// reads the typed tokens.
fn draw(ui: &mut egui::Ui) {
    let tokens = theme::Tokens::of(ui.ctx());
    ui.colored_label(tokens.status.success, "Saved");
    let _ = ui.button("A themed button");
}

egui is re-exported: use egui_pop::egui to be sure to get the version egui-pop was built for (one egui-pop minor per egui minor).

Re-exports§

pub use egui;
pub use egui_pop_api::eframe;
pub use egui_pop_tokens as tokens;
pub use egui_pop_fit as fit;
pub use egui_pop_model as model;
pub use egui_pop_core as core;
pub use egui_pop_api as api;

Modules§

layers
Layer ranks: what lies over what in a window’s foreground (from egui-pop-core, ADR 0026).
mounts
The mount contract across the crates enabled (ADR 0013): every component and host declared, in docs/hosts.md’s order, the page written from them, and MountsPlugin, which declares the components and hosts of the component crates to the application so that AppHandle::where_can and the mounts collector know them.
prelude
What most applications use.
theme
Themes: tokens into egui’s style (from egui-pop-core). Themes for egui: resolved design tokens turned into egui’s Visuals and Style, installed into a Context, and kept there as a typed Tokens set for custom widgets.

Constants§

VERSION
egui-pop’s version: this crate’s, the one an application depends on.