feat: allow ansi color

This commit is contained in:
Pihkaal
2024-01-18 23:29:11 +01:00
parent 2be41dd4d4
commit 77aa0417a6
2 changed files with 9 additions and 2 deletions

2
config
View File

@@ -14,7 +14,7 @@ fps=30
# Which color mode to use # Which color mode to use
# Value: "term", "hex" or "ansi" # Value: "term", "hex" or "ansi"
color_mode=hex color_mode=ansi
# Loaded if color_mode is set to "term" # Loaded if color_mode is set to "term"
# Value: 0-15 # Value: 0-15

View File

@@ -34,7 +34,10 @@ fn load_color(ini: &Ini) -> Color {
let color = ini.get("styling", "color_hex").unwrap(); let color = ini.get("styling", "color_hex").unwrap();
return load_hex_color(&color); return load_hex_color(&color);
} }
"ansi" => todo!(), "ansi" => {
let color = ini.getint("styling", "color_ansi").unwrap().unwrap();
return load_ansi_color(color);
}
_ => panic!("ERROR: Invalid color mode: {}", color_mode), _ => panic!("ERROR: Invalid color mode: {}", color_mode),
} }
} }
@@ -87,3 +90,7 @@ fn load_hex_color(value: &str) -> Color {
return Color::Rgb { r, g, b }; return Color::Rgb { r, g, b };
} }
fn load_ansi_color(value: i64) -> Color {
return Color::AnsiValue(value.try_into().unwrap());
}