pictogram 0.3.0

A compile time svg icon resolver.
Documentation

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.