feat: colored the ascii logos
added enum colors to distro art arrays code refactor: logo items are now structs
This commit is contained in:
@@ -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,47 +287,58 @@ std::vector<string> distroArt() {
|
|||||||
|
|
||||||
readOsRelease.close();
|
readOsRelease.close();
|
||||||
|
|
||||||
string asciiArts[][9] = {
|
const std::vector<DistroLogo> logos = {
|
||||||
{
|
{
|
||||||
"arch",
|
"arch",
|
||||||
" /\\ ",
|
Color::Blue,
|
||||||
" / \\ ",
|
{
|
||||||
" / \\ ",
|
" /\\ ",
|
||||||
" / \\ ",
|
" / \\ ",
|
||||||
" / ,, \\ ",
|
" / \\ ",
|
||||||
" / | | \\ ",
|
" / \\ ",
|
||||||
"/_-'' ''-_\\",
|
" / ,, \\ ",
|
||||||
" "
|
" / | | \\ ",
|
||||||
|
"/_-'' ''-_\\",
|
||||||
|
" "
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cachyos",
|
"cachyos",
|
||||||
" /''''''''''''/ ",
|
Color::Green,
|
||||||
" /''''''''''''/ ",
|
{
|
||||||
" /''''''/ ",
|
" /''''''''''''/ ",
|
||||||
"/''''''/ ",
|
" /''''''''''''/ ",
|
||||||
"\\......\\ ",
|
" /''''''/ ",
|
||||||
" \\......\\ ",
|
"/''''''/ ",
|
||||||
" \\.............../",
|
"\\......\\ ",
|
||||||
" \\............./ "
|
" \\......\\ ",
|
||||||
|
" \\.............../",
|
||||||
|
" \\............./ "
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"debian",
|
"debian",
|
||||||
" _____ ",
|
Color::Red,
|
||||||
" / __ \\",
|
{
|
||||||
"| / |",
|
" _____ ",
|
||||||
"| \\___-",
|
" / __ \\",
|
||||||
"-_ ",
|
"| / |",
|
||||||
" --_ ",
|
"| \\___-",
|
||||||
" ",
|
"-_ ",
|
||||||
" "
|
" --_ ",
|
||||||
|
" ",
|
||||||
|
" "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user