feat: colored the ascii logos

added enum colors to distro art arrays
code refactor: logo items are now structs
This commit is contained in:
2026-05-25 20:07:47 +03:00
parent e9f1bd31f1
commit d07b345b79
+23 -5
View File
@@ -3,6 +3,7 @@
#include <filesystem> #include <filesystem>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <array>
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <unordered_map> #include <unordered_map>
@@ -55,6 +56,12 @@ enum class Color {
string color(Color c); string color(Color c);
struct DistroLogo {
string id;
Color color;
std::array<string, 8> art;
};
struct gpuId { struct gpuId {
string vendor; string vendor;
string device; string device;
@@ -280,9 +287,11 @@ std::vector<string> distroArt() {
readOsRelease.close(); readOsRelease.close();
string asciiArts[][9] = { const std::vector<DistroLogo> logos = {
{ {
"arch", "arch",
Color::Blue,
{
" /\\ ", " /\\ ",
" / \\ ", " / \\ ",
" / \\ ", " / \\ ",
@@ -291,9 +300,12 @@ std::vector<string> distroArt() {
" / | | \\ ", " / | | \\ ",
"/_-'' ''-_\\", "/_-'' ''-_\\",
" " " "
}
}, },
{ {
"cachyos", "cachyos",
Color::Green,
{
" /''''''''''''/ ", " /''''''''''''/ ",
" /''''''''''''/ ", " /''''''''''''/ ",
" /''''''/ ", " /''''''/ ",
@@ -302,9 +314,12 @@ std::vector<string> distroArt() {
" \\......\\ ", " \\......\\ ",
" \\.............../", " \\.............../",
" \\............./ " " \\............./ "
}
}, },
{ {
"debian", "debian",
Color::Red,
{
" _____ ", " _____ ",
" / __ \\", " / __ \\",
"| / |", "| / |",
@@ -314,13 +329,16 @@ std::vector<string> distroArt() {
" ", " ",
" " " "
} }
}
}; };
std::vector<string> out; std::vector<string> out;
for (int i = 0; i < static_cast<int>(sizeof(asciiArts) / sizeof(asciiArts[0])); ++i) { for (const auto& logo : logos) {
if (asciiArts[i][0] == distroID) { if (logo.id == distroID) {
for (int j = 1; j < 9; ++j) { const string prefix = color(logo.color);
out.push_back(asciiArts[i][j]); const string suffix = color(Color::Reset);
for (const auto& line : logo.art) {
out.push_back(prefix + line + suffix);
} }
return out; return out;
} }