8 releases (4 breaking)

0.5.0 Apr 11, 2024
0.4.0 Feb 11, 2024
0.3.2 Jan 9, 2024
0.3.1 Nov 24, 2023
0.1.0 Apr 21, 2023

#100 in GUI

Download history 340/week @ 2024-01-05 251/week @ 2024-01-12 285/week @ 2024-01-19 177/week @ 2024-01-26 132/week @ 2024-02-02 456/week @ 2024-02-09 600/week @ 2024-02-16 543/week @ 2024-02-23 478/week @ 2024-03-01 771/week @ 2024-03-08 375/week @ 2024-03-15 183/week @ 2024-03-22 279/week @ 2024-03-29 308/week @ 2024-04-05 253/week @ 2024-04-12 229/week @ 2024-04-19

1,096 downloads per month
Used in 3 crates

MIT/Apache

785KB
6.5K 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.5.0"

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.5–10MB
~78K SLoC