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 <iostream>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <unordered_map>
|
||||
@@ -55,6 +56,12 @@ enum class Color {
|
||||
|
||||
string color(Color c);
|
||||
|
||||
struct DistroLogo {
|
||||
string id;
|
||||
Color color;
|
||||
std::array<string, 8> art;
|
||||
};
|
||||
|
||||
struct gpuId {
|
||||
string vendor;
|
||||
string device;
|
||||
@@ -280,9 +287,11 @@ std::vector<string> distroArt() {
|
||||
|
||||
readOsRelease.close();
|
||||
|
||||
string asciiArts[][9] = {
|
||||
const std::vector<DistroLogo> logos = {
|
||||
{
|
||||
"arch",
|
||||
Color::Blue,
|
||||
{
|
||||
" /\\ ",
|
||||
" / \\ ",
|
||||
" / \\ ",
|
||||
@@ -291,9 +300,12 @@ std::vector<string> distroArt() {
|
||||
" / | | \\ ",
|
||||
"/_-'' ''-_\\",
|
||||
" "
|
||||
}
|
||||
},
|
||||
{
|
||||
"cachyos",
|
||||
Color::Green,
|
||||
{
|
||||
" /''''''''''''/ ",
|
||||
" /''''''''''''/ ",
|
||||
" /''''''/ ",
|
||||
@@ -302,9 +314,12 @@ std::vector<string> distroArt() {
|
||||
" \\......\\ ",
|
||||
" \\.............../",
|
||||
" \\............./ "
|
||||
}
|
||||
},
|
||||
{
|
||||
"debian",
|
||||
Color::Red,
|
||||
{
|
||||
" _____ ",
|
||||
" / __ \\",
|
||||
"| / |",
|
||||
@@ -314,13 +329,16 @@ std::vector<string> distroArt() {
|
||||
" ",
|
||||
" "
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<string> out;
|
||||
for (int i = 0; i < static_cast<int>(sizeof(asciiArts) / sizeof(asciiArts[0])); ++i) {
|
||||
if (asciiArts[i][0] == distroID) {
|
||||
for (int j = 1; j < 9; ++j) {
|
||||
out.push_back(asciiArts[i][j]);
|
||||
for (const auto& logo : logos) {
|
||||
if (logo.id == distroID) {
|
||||
const string prefix = color(logo.color);
|
||||
const string suffix = color(Color::Reset);
|
||||
for (const auto& line : logo.art) {
|
||||
out.push_back(prefix + line + suffix);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user