API ReferenceText & Media
Icon
Vector path icons and font glyph icons.
Vector icons paint a retained Path; default size = 24, white brush.
use incular::prelude::*;
use incular::widgets::internal::icons;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = Application::new(|_cx| {
Container::builder()
.padding(EdgeInsets::all(24.0))
.alignment(Alignment::CENTER)
.child(
Row::builder()
.spacing(16.0)
.children(Vec::<Widget>::from([
Icon::new(icons::check()).size(24.0).into(),
Icon::new(icons::close())
.size(32.0)
.brush(Brush::from(Color::rgba(200, 30, 30, 255))).into(),
Icon::new(icons::plus()).size(24.0).into(),
]))
.build(),
)
.build()
.into()
})?;
incular::run(app)?;
Ok(())
}Built-in paths: check, close, plus, minus, chevron_right,
chevron_down, chevron_up, chevron_left. size clamps to max(0.0).
| Glyph | Shape |
|---|---|
check | Tick mark |
close | X mark |
plus / minus | Arithmetic marks |
chevron_right / chevron_down / chevron_up / chevron_left | Directional chevrons |
IconTheme scopes default icon size/color/density for descendant icons.
Font glyphs use IconData through the
text pipeline instead:
use incular::prelude::*;
fn main() {
let icon = IconData::new(0xE001).family(FontFamily::Named("Icons".into()));
println!("code: {:X}", icon.code_point());
let app = Application::new(|_cx| Text::new("Icon").into())
.expect("valid application");
incular::run(app).expect("run application");
}