| Crates.io | google-material-design-icons-bin |
| lib.rs | google-material-design-icons-bin |
| version | 0.1.2 |
| created_at | 2026-01-01 16:09:49.209072+00 |
| updated_at | 2026-01-01 16:38:16.705095+00 |
| description | Embedded Google Material Design icons, packed into a compact binary for fast lookup |
| homepage | |
| repository | https://github.com/edgarhsanchez/google_material_design_icons_bin |
| max_upload_size | |
| id | 2016380 |
| size | 6,545,764 |
Embedded Google Material Design icons packed into a compact binary for fast lookup.
This crate embeds 48×48 baseline icons as ALPHA8 (1 byte/pixel). That keeps the data small and lets consumers tint the icon at render time.
[dependencies]
google-material-design-icons-bin = "0.1"
The generated module mirrors the upstream material-design-icons/android/ tree:
use google_material_design_icons_bin::material_icons;
// Direct access via modules (fast, no strings):
let icon = material_icons::android::action::account_balance;
assert_eq!(icon.width, 48);
assert_eq!(icon.height, 48);
// Raw alpha bytes (len == width * height):
let alpha: &[u8] = icon.alpha();
assert_eq!(alpha.len(), icon.width as usize * icon.height as usize);
If you need string-based lookup:
use google_material_design_icons_bin::material_icons;
let icon = material_icons::by_path("android/action/account_balance").unwrap();
let same = material_icons::by_name("account_balance").unwrap();
assert_eq!(icon, same);
You can also iterate everything:
use google_material_design_icons_bin::material_icons;
for (path, icon) in material_icons::ALL {
let _ = (path, icon.width, icon.height, icon.alpha());
}
lz4 (default): embeds an LZ4-compressed alpha blob and decompresses once lazily on first use.uncompressed: embeds an uncompressed alpha blob (larger crate; no decompression).Examples:
# Default (LZ4)
cargo build
# Force uncompressed
cargo build --no-default-features --features uncompressed
This repo ships with pre-generated files in data/ and src/material_icons.rs.
To regenerate from a local checkout of material-design-icons:
cargo run --bin gen_icons --release -- --icons-dir C:\\github\\material-design-icons --out .
Alternatively you can set MATERIAL_DESIGN_ICONS_DIR and omit --icons-dir.
by_name() returns the first match if multiple categories contain the same icon name.LICENSE).material-design-icons and is Apache-2.0 licensed (see LICENSE-APACHE and THIRD_PARTY_NOTICES.md).