functora-egui 0.2.0

shadcn/ui-inspired widget library for egui - buttons, inputs, selects, dialogs, and 70+ more components with light/dark theming
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Widget trait implementation for Hyperlink.

impl egui::Widget for super::widget::Hyperlink {
    fn ui(self, ui: &mut egui::Ui) -> egui::Response {
        let theme = crate::theme::shadcn_theme_ext::ShadcnThemeExt::shadcn_theme(ui.ctx());
        let previous = ui.visuals().hyperlink_color;
        ui.visuals_mut().hyperlink_color = theme.primary;
        let response = if let Some(url) = self.url {
            ui.add(
                egui::Hyperlink::from_label_and_url(self.label, url).open_in_new_tab(self.new_tab),
            )
        } else {
            ui.add(egui::Link::new(self.label))
        };
        ui.visuals_mut().hyperlink_color = previous;
        response
    }
}