lx_cli/
icon.rs

1/// Handles file type icons and their associated colors.
2use crate::config::ColorConfig;
3use colored::Color;
4
5#[derive(Debug, Clone, Copy)]
6pub enum FileIcon {
7    Directory,
8    Executable,
9    RegularFile,
10}
11
12// TODO: Add more file types and icons, as well as the ability to set custom icons in the config
13impl FileIcon {
14    pub fn as_str(&self) -> &str {
15        match self {
16            FileIcon::Directory => "",
17            FileIcon::Executable => "",
18            FileIcon::RegularFile => "",
19        }
20    }
21
22    pub fn get_color(&self, config: &ColorConfig) -> Color {
23        match self {
24            FileIcon::Directory => config.get_directory_color(),
25            FileIcon::Executable => config.get_executable_color(),
26            FileIcon::RegularFile => config.get_regular_color(),
27        }
28    }
29}