| Crates.io | simpleicons-rs |
| lib.rs | simpleicons-rs |
| version | 16.6.1 |
| created_at | 2025-08-11 07:52:32.069208+00 |
| updated_at | 2026-01-25 00:49:12.825664+00 |
| description | SVG icons for popular brands |
| homepage | |
| repository | https://github.com/cscnk52/simpleicons-rs |
| max_upload_size | |
| id | 1789721 |
| size | 5,635,690 |
simpleicons-rs lets you fetch or embed SVGs from the Simple Icons collection in Rust:
csscolorparser).cargo add simpleicons-rs
[!IMPORTANT] Please read the legal disclaimer before using any icon.
function will return Icon as follow:
pub struct Icon {
pub title: &'static str,
pub slug: &'static str,
pub hex: &'static str,
pub source: &'static str,
pub svg: &'static str,
}
Use runtime lookup for flexibility, or a compile‑time constant for zero lookup:
use simpleicons_rs::{slug, SIRUST};
fn main() {
let dynamic = slug("rust").unwrap(); // runtime lookup
let constant = SIRUST; // compile-time constant
println!("{}", dynamic.svg);
println!("{}", constant.svg);
}
Error handling:
match simpleicons_rs::slug("not-a-slug") {
Some(icon) => println!("Found {}", icon.title),
None => eprintln!("Icon not found"),
}
use simpleicons_rs::slug_colored;
fn main() {
let slug = "rust";
// Official brand color
let brand = slug_colored(slug, "default").unwrap();
// CSS named color
let named = slug_colored(slug, "black").unwrap();
// Hex
let hexed = slug_colored(slug, "#181717").unwrap();
// Any csscolorparser format: #abc, rgb(), rgba(), hsl(), hsla(), etc.
let hsl = slug_colored(slug, "hsl(10 10% 10%)").unwrap();
println!("{}", brand.svg);
}
This repo (builder) generates the publishable crate.
git clone https://github.com/cscnk52/simpleicons-rs.git
cd simpleicons-rs
cargo run
Generated crate appears under build/crates.
Then:
cd build/crates
cargo publish --allow-dirty