12 releases (6 breaking)

0.7.3 Oct 11, 2024
0.7.1 Sep 30, 2024
0.6.0 Jul 30, 2024
0.4.0 Feb 11, 2024
0.2.0 Jul 25, 2023

#55 in GUI

Download history 272/week @ 2024-08-21 525/week @ 2024-08-28 523/week @ 2024-09-04 712/week @ 2024-09-11 461/week @ 2024-09-18 814/week @ 2024-09-25 885/week @ 2024-10-02 1495/week @ 2024-10-09 1080/week @ 2024-10-16 722/week @ 2024-10-23 1327/week @ 2024-10-30 1104/week @ 2024-11-06 762/week @ 2024-11-13 755/week @ 2024-11-20 612/week @ 2024-11-27 1078/week @ 2024-12-04

3,456 downloads per month
Used in 5 crates

MIT/Apache

1MB
15K SLoC

egui_phosphor

Bundles Phosphor icons with boilerplate to use in your egui app.

Installation

Add the crate as a dependency in Cargo.toml:

egui-phosphor = "0.7.3"

On startup, update the fonts in your egui context:

let mut fonts = egui::FontDefinitions::default();
egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Regular);

cc.egui_ctx.set_fonts(fonts);

The above add_to_fonts helper adds the chosen variant (Regular) as a fallback to the primary egui Proportional font so that when you use Phosphor icons mixed with plain text in labels, the icon font will take over where necessary. If you want to add multiple variants of Phosphor icons, see this example which shows all variants in use.

Usage

Use the constants provided by the crate in your text:

ui.label(egui::RichText::new(format!("FILE_CODE {}", egui_phosphor::regular::FILE_CODE)).size(32.0));

Note: Make sure to use the appropriate character codes for your chosen variant! This means for Variant::Regular you should use regular::FILE_CODE, for Variant::Fill you should use fill::FILE_CODE etc.

License

egui-phosphor is licensed under MIT OR Apache-2.0. Phosphor Icons are licensed under MIT.

Dependencies

~4–9MB
~84K SLoC