Expand description
Procedural vector icons: a shared visual vocabulary that replaces words.
Every icon is drawn from anti-aliased crate::shapes primitives inside a
square box, so it stays crisp at any size from small HUD glyphs (12 px) to
large menu art (128 px) and batches with ordinary immediate drawing. Icons
are two-tone: the main color paints the silhouette and a darker detail
tone paints inner marks (a coin’s rim, a clock’s hands), so they read on
both light and dark surfaces without needing a cut-out background.
Coordinates are the current camera’s logical units. Nothing allocates. Non-finite input or a non-positive size draws nothing.
use ferravex_render::{Color, vec2, icons::{self, Icon, IconStyle}};
icons::draw(Icon::Heart, vec2(24., 24.), 24., Color::from_hex(0xe5484d));
icons::draw_styled(Icon::Coin, vec2(60., 24.), 24.,
IconStyle::new(Color::from_hex(0xf7b553)).shadow(Color::new(0., 0., 0., 0.4)));
icons::badge(Icon::Pause, vec2(100., 24.), 32., Color::from_hex(0x1f2a3d),
Color::from_hex(0xeef2f5));
assert_eq!(Icon::from_name("heart"), Some(Icon::Heart));
assert!(Icon::ALL.iter().all(|i| Icon::from_name(i.name()) == Some(*i)));Structs§
- Icon
Style - Colors for one icon draw.
Enums§
Functions§
- badge
- A filled circle of
diameterwithiconcentered on it at 58% size. - draw
- Draw
iconcentered atcenter, fitted to asize×sizebox. - draw_
styled - Draw
iconwith explicit detail and shadow colors.