Skip to main content

Crate egui_sauge

Crate egui_sauge 

Source
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

§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 the egui::Context so 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::Custom lets you inject a painter, Icon::Glyph lets you reference any Phosphor codepoint directly.
Locale
Language used for built-in component strings.

Constants§

RADIUS
The canonical radius scale.
SPACING
The canonical spacing scale (4, 8, 12, 16, 24, 32, 48, 64).

Functions§

apply_theme
Push a theme based on palette onto ctx with the default Density::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_theme but lets the caller pick a Density.
density_of
Current Density for ctx. Returns Density::Comfortable if 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 so crate::Icon glyphs render.
install_phosphor_variant
Register an additional egui_phosphor::Variant on top of the regular font that install_fonts already wires.
locale_of
Current Locale for ctx. Defaults to Locale::En.
palette_of
Current Palette for ctx. Returns Palette::light() if no theme has been applied yet.
reduce_motion
Whether motion-sensitive UIs should freeze their animations.
set_locale
Set the active Locale on ctx. 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. See reduce_motion.

Type Aliases§

IconPainter
Signature for custom icon painters. See Icon::Custom.