BREP_app 0.36.0

The next.BREP.io CAD application on the Rust B-rep kernel: an eframe (egui + wgpu) host that draws the brep-render 3D engine into an egui frame, native + wasm from one codebase.
Documentation
//! Status text for the workbench panels (CAM, simulation, instructions, PMI,
//! sketch,...): errors, warnings and successes in the theme's state colours,
//! so a panel never writes a colour of its own. Lane UI-WORKBENCHES, rollout
//! step 5; an addition to the ui_kit API, nothing in it changes an existing
//! component.
use super::surface::Kind;
use crate::theme;
use eframe::egui;

/// The colour of a state kind in the theme stored for `ctx` (the default theme
/// when none is installed).
pub fn color(ctx: &egui::Context, kind: Kind) -> egui::Color32 {
    kind.color(&theme::current(ctx))
}

/// `danger`: error text.
pub fn danger(ctx: &egui::Context) -> egui::Color32 {
    color(ctx, Kind::Error)
}

/// `warning`: notices that need the user's attention.
pub fn warning(ctx: &egui::Context) -> egui::Color32 {
    color(ctx, Kind::Warning)
}

/// `success`: something finished or passed.
pub fn success(ctx: &egui::Context) -> egui::Color32 {
    color(ctx, Kind::Success)
}

/// A label in the colour of `kind`. Returns the label's response, so a caller
/// publishes its hit key from the rect as it did for `ui.colored_label`.
pub fn label(ui: &mut egui::Ui, kind: Kind, text: impl Into<String>) -> egui::Response {
    let ink = color(ui.ctx(), kind);
    ui.label(egui::RichText::new(text).color(ink))
}

/// An error line.
pub fn error(ui: &mut egui::Ui, text: impl Into<String>) -> egui::Response {
    label(ui, Kind::Error, text)
}

/// A warning line.
pub fn warn(ui: &mut egui::Ui, text: impl Into<String>) -> egui::Response {
    label(ui, Kind::Warning, text)
}

/// A success line.
pub fn ok(ui: &mut egui::Ui, text: impl Into<String>) -> egui::Response {
    label(ui, Kind::Success, text)
}