Expand description
§egui_sauge
A fresh, natural design system for egui — sage palette, warm neutrals, WCAG AA contrast, and a ready-to-use component library aimed at IT applications.
§Quickstart
use eframe::egui;
use egui_sauge::{Palette, Density, apply_theme_with, install_fonts, set_locale, Locale};
eframe::run_native(
"My app",
eframe::NativeOptions::default(),
Box::new(|cc| {
install_fonts(&cc.egui_ctx);
apply_theme_with(&cc.egui_ctx, &Palette::light(), Density::Comfortable);
set_locale(&cc.egui_ctx, Locale::En); // or Locale::Fr
Ok(Box::new(MyApp::default()) as Box<dyn eframe::App>)
}),
)§What you get
Palette— 20 semantic color roles, light + dark modes, WCAG AA validated bytests/contrast.rs.SPACING/RADIUS/Elevation— numerical token tables.Icon— ~80 named icons backed by Phosphor, plusIcon::GlyphandIcon::Customescape hatches.Densitypreset (Comfortable/Compact) andLocale(En/Fr) read fromegui::Contextby every component.- A
componentsmodule with buttons, cards, alerts, inputs, dialogs, toasts, navigation primitives, menus + submenus, etc.
§Modules
components— opinionated, ready-to-use UI atoms and containers.
§See also
GUIDE.md— UX/UI playbook (composition, navigation, modal vs side panel, button order, i18n…).cargo run --example showcase— every component in one window.
Modules§
- components
- Ready-to-use components built on top of
crate::Palette+crate::apply_theme. Each component reads the active palette/density from theegui::Contextso you don’t have to pass them around.
Structs§
- Palette
- A full set of semantic colors for one theme mode (light or dark).
- Radius
- Border radius scale.
- Spacing
- 4-point spacing scale.
Enums§
- Density
- UI density.
- Elevation
- Four elevation levels: 0 flat, 1 card, 2 popover, 3 modal.
- Icon
- Icon set. Most variants resolve to a Phosphor codepoint;
Icon::Customlets you inject a painter,Icon::Glyphlets you reference any Phosphor codepoint directly. - Locale
- Language used for built-in component strings.
Constants§
Functions§
- apply_
theme - Push a theme based on
paletteontoctxwith the defaultDensity::Comfortable. Safe to call every frame when the palette may change (e.g. light/dark toggle); otherwise call once at startup. - apply_
theme_ with - Like
apply_themebut lets the caller pick aDensity. - density_
of - Current
Densityforctx. ReturnsDensity::Comfortableif no theme has been applied yet. - install_
fonts - Install the canonical text-style scale on
ctx(display / heading / h2 / h3 / body-lg / body / button / small / monospace), and register the Phosphor icon font socrate::Iconglyphs render. - install_
phosphor_ variant - Register an additional
egui_phosphor::Varianton top of the regular font thatinstall_fontsalready wires. - locale_
of - Current
Localeforctx. Defaults toLocale::En. - palette_
of - Current
Paletteforctx. ReturnsPalette::light()if no theme has been applied yet. - reduce_
motion - Whether motion-sensitive UIs should freeze their animations.
- set_
locale - Set the active
Localeonctx. Independent from theming — safe to call anytime; affected components pick up the change next frame. - set_
reduce_ motion - Toggle the reduce-motion flag for
ctx. Seereduce_motion.
Type Aliases§
- Icon
Painter - Signature for custom icon painters. See
Icon::Custom.