Expand description
§Pictogram
Pictogram resolves icons at compile time using data stored in the manifest directory. During compilation an icon is looked up and baked into your application. This bypasses compilation penalties as the entire icon data does not have to be compiled by rustc.
§Features
- Support for many libraries: See supported libraries for more information.
- Type-Safe: If an icon can’t be resolved, it will lead to a compilation error.
- Compile-Time: Icons are baked into your code at compile time.
- Only pay for what you need: Only compile the icons, you actually use.
- Framework independent: Although, there is an adapter for dioxus.
- NOT vibe coded.
§How to use it
# By default all features are enabled
pictogram = { version = "*", features=["material"] }ⓘ
let svg = pictogram::svg!(pictogram::material::action_123::filled);
println!("{}", svg);§Dioxus adapter
The adapter is available here.
ⓘ
// Define icons locally - from the index
define_icon!(pictogram::material::social_person::filled);
// Or from your local assets
define_icon!(CustomIcon, "local-path-to-custom-icon.svg");
#[component]
fn SomeComponent() -> Element {
rsx! {
// Or use the general component
Icon {
icon: pictogram::svg!(pictogram::material::image_crop_free::outlined),
width: "3rem",
height: "3rem",
// Compose icons
SocialPersonFilled {
height: 16,
width: 16,
x: 4,
y: 4
}
}
CustomIcon {
width: "3rem",
height: "3rem"
}
}
}§Supported libraries
Feel free to make a PR to add more libraries or ask for it in an issue.
| Library | Feature | License | Crate |
|---|---|---|---|
| Material design icons | material | Apache-2.0 | material |
| Bootstrap | bootstrap | MIT | bootstrap |
| Feather | feather | MIT | feather |
| Font Awesome | font-awesome | CC BY 4.0 | font-awesome |
| Tabler | tabler | MIT | tabler |
| Simple | simple | CC0-1.0 | simple |
| Heroicons | hero | MIT | hero |
| Ionicons | ion | MIT | ion |
| Lucide | lucid | ISC | lucide |
| Primer Octicons | oct | MIT | oct |
| Vscode Codicons | vscode | CC BY 4.0 | vscode |
§License
This project is licensed under either
at your option.
§Icon Licenses
All icons are licensed under their respective licenses. Please contact me, if any repository would like to be removed/updated.
Modules§
- bootstrap
- Index to lookup available icons from bootstrap Exports the index of the available icons
- feather
- Index to lookup available icons from feather Exports the index of the available icons
- font_
awesome - Index to lookup available icons from font awesome Exports the index of the available icons
- hero
- Index to lookup available icons from heroicons Exports the index of the available icons
- ion
- Index to lookup available icons from ion Exports the index of the available icons
- lucide
- Index to lookup available icons from lucide Exports the index of the available icons
- material
- Index to lookup available icons from material Exports the index of the available icons
- oct
- Index to lookup available icons from oct Exports the index of the available icons
- simple
- Index to lookup available icons from simple Exports the index of the available icons
- tabler
- Index to lookup available icons from tabler Exports the index of the available icons
- vscode
- Index to lookup available icons from vscode Exports the index of the available icons
Macros§
- svg
- Macro to lookup a SVG at compile time. Wraps the proc-macro for better ergonomics.
Structs§
- Svg
- The emitted SVG by the macro! Right now only xmlns and viewBox are extracted. The body is just extracted as a whole.
- SvgParse
Error - ViewBox
- ViewBox auf the SVG