rust-devicons 0.2.3

A Rust library to retrieve filetype glyphs (icons) for a wide range of common file formats.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use devicons::{icon_for_file, File, Theme};
use std::path::Path;

fn main() {
    // Create a new file instance for a directory "my_folder/"
    let path = Path::new("my_folder/");
    let file = File::new(path);

    // Get the icon for this directory with the light theme
    let icon = icon_for_file(&file, Some(Theme::Light));

    // Print its corresponding icon
    println!("Filename: {}", file.name);
    println!("Icon: {}", icon.icon);
    println!("Color: {}", icon.color);
}