#material #material-icons #icons

material-code-icons

VS Code Material Icon Theme in Rust

1 unstable release

0.1.0 Dec 26, 2022

#9 in #material-icons

Apache-2.0

2.5MB
7.5K SLoC

TypeScript 7K SLoC // 0.1% comments Rust 165 SLoC JavaScript 97 SLoC // 0.1% comments

material-code-icons

This crate uses the icons from the VS Code Material Icon Theme and makes them available in your rust code.

The main point of interaction in this crate is code_icon(). It takes a file name, folder name, or file extension and returns an SVG as a &[u8].

let icon_from_file_name_extension = code_icon("lib.rs");
let icon_from_extension = code_icon("rs");
let icon_from_file_name = code_icon(".gitignore");
let icon_from_folder_name = code_icon("src");
let icon = material_code_icons::RUST;

Currently, this crate does not provide any other return types, and you need to deserialize the SVG with another crate, but if there is a popular SVG or image type in Rust then it is possible to add support for it if you open an issue.


lib.rs:

This crate uses the icons from the VS Code Material Icon Theme and makes them available in your rust code.

The main point of interaction in this crate is code_icon(). It takes a file name, folder name, or file extension and returns an SVG as a &[u8]. If you know which icon you want ahead of time, you can also refer to it specifically.

let icon_from_extension = code_icon("rs");
let icon_from_file_name = code_icon(".gitignore");
let icon_from_file_name_extensions = code_icon("lib.rs");
let icon_from_folder_name = code_icon("src");
let icon = material_code_icons::RUST;

Currently, this crate does not provide any other return types, and you need to deserialize the SVG with another crate, but if there is a popular SVG or image type in Rust then it is possible to add support for it if you open an issue.

Dependencies