Skip to main content

egui_charts/ui/drawing_toolbar/components/
mod.rs

1//! Buttons, separators and SVG helpers for composing drawing toolbars.
2//!
3//! Use [`PairButton`] for a tool button with a separate flyout trigger, or the
4//! button functions for individual tools and toggles.
5
6pub mod icon_button;
7pub mod pair_button;
8pub mod separator;
9pub mod svg_helpers;
10
11// Re-export all public components
12pub use icon_button::{draw_icon_btn, draw_icon_button_padded, draw_toggle_btn, draw_tool_button};
13pub use pair_button::{ArrowDirection, PairButton, PairButtonResponse, draw_arrow};
14pub use separator::{draw_separator, draw_separator_styled, draw_separator_with_margin};
15pub use svg_helpers::{render_svg_at_rect_themed, render_svg_centered};
16
17/// Fill of a selected button under the pointer: the pressed fill, lifted slightly.
18fn active_hover_color(ui: &egui::Ui) -> egui::Color32 {
19    let active = ui.visuals().widgets.active.bg_fill;
20    egui::Color32::from_rgb(
21        active.r().saturating_add(5),
22        active.g().saturating_add(5),
23        active.b().saturating_add(5),
24    )
25}