Crate embedded_iconoir

source ·
Expand description

Icons for Embedded and Resource Constrained Systems

The embedded-iconoir crate allows you to use over 1300 icons on all platforms and displays that support embedded_graphics.

Usage

// Import icons and traits
use embedded_iconoir::prelude::*;

// Create an icon
let icon = icons::size24px::actions::Download::new(BinaryColor::On);

// Wrap it in an embedded_graphics image
let image = Image::new(&icon, Point::zero());

// Draw it to a display
image.draw(&mut display).unwrap();

Storage Size

Using the crate will - without using any icons - not increase your binary size at all. All icons that you use are automatically included in the binary. If you use an icon multiple times, it’ll only increase your binary size once per resolution.

Resolutions

You can choose which resolutions to enable via features. Available resolutions are:

ResolutionModuleBytes per Icon
12pxsize12px18
16pxsize16px32
18pxsize18px41
24pxsize24px72
32pxsize32px128
48pxsize48px288
96pxsize96px1152 (== 1.2kb)
144pxsize144px2592 (== 2.6kb)

Preview or find an icon

To see a preview of the included icons, please check out the Iconoir Website. All categories on the website are available as sub-modules of the resolution modules (e.g. the download icon in the Actions category can be found at the path icons::size__px::actions::Download.

“But I want a different resolution!”

That is certainly doable. All resolutions are dynamically generated, and the ones that are available are so because they seemed to fit a fairly broad spectrum of use cases. If something is missing in your opinion, please open an issue on GitHub. Note that bigger resolutions as well as a high amount of different resolutions (e.g 10px, 11px, …, 47px, 48px) will at some point conflict with crates.io’s max package size of 10MB, as the icons are pre-baked. So, if this is relevant for your use case, forking the repository and using it as a Git dependency is a better idea.

Developing locally

To develop embedded-iconoir locally, clone the repository from GitHub, and then execute git submodule init and git submodule update to pull Iconoir into the repository. After that, run cargo xtask generate to render the icons to .bits files, and generate the code.

Contributing

If you found a bug, or think that a feature is missing, please open an issue on GitHub. Of course, Pull Requests are also very much appreciated.

Re-exports

Modules

Macros

Structs

  • Struct to store icon color and properties.