From af22b2e186db914474e47da680ba25d85167e8a2 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Tue, 27 Jul 2021 22:23:39 +0200 Subject: [PATCH] [v0.98][PPC] Added IBM color scheme --- cpufetch.1 | 3 +++ src/common/args.c | 6 ++++++ src/common/main.c | 3 ++- src/common/printer.c | 4 +--- src/common/printer.h | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cpufetch.1 b/cpufetch.1 index 80d2925..a1a201b 100644 --- a/cpufetch.1 +++ b/cpufetch.1 @@ -37,6 +37,9 @@ Use Intel default color scheme * "amd": Use AMD default color scheme .TP +* "ibm": +Use IBM default color scheme +.TP * "arm": Use ARM default color scheme .TP diff --git a/src/common/args.c b/src/common/args.c index e9239bc..8cd16f2 100644 --- a/src/common/args.c +++ b/src/common/args.c @@ -7,6 +7,7 @@ #define COLOR_STR_INTEL "intel" #define COLOR_STR_AMD "amd" +#define COLOR_STR_IBM "ibm" #define COLOR_STR_ARM "arm" static const char *SYTLES_STR_LIST[] = { @@ -131,6 +132,11 @@ bool parse_color(char* optarg_str, struct colors** cs) { strcpy(str_to_parse, COLOR_DEFAULT_AMD); free_ptr = true; } + else if(strcmp(optarg_str, COLOR_STR_IBM) == 0) { + str_to_parse = malloc(sizeof(char) * 45); + strcpy(str_to_parse, COLOR_DEFAULT_IBM); + free_ptr = true; + } else if(strcmp(optarg_str, COLOR_STR_ARM) == 0) { str_to_parse = malloc(sizeof(char) * 46); strcpy(str_to_parse, COLOR_DEFAULT_ARM); diff --git a/src/common/main.c b/src/common/main.c index 6666cf0..1294246 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -61,8 +61,9 @@ void print_help(char *argv[]) { printf("\nCOLORS: \n"); printf(" * \"intel\": Use Intel default color scheme \n"); printf(" * \"amd\": Use AMD default color scheme \n"); + printf(" * \"ibm\", Use IBM default color scheme \n"); printf(" * \"arm\": Use ARM default color scheme \n"); - printf(" * custom: If color argument do not match \"intel\", \"amd\" or \"arm\", a custom scheme can be specified.\n"); + printf(" * custom: If color argument do not match \"intel\", \"amd\", \"ibm\" or \"arm\", a custom scheme can be specified.\n"); printf(" 4 colors must be given in RGB with the format: R,G,B:R,G,B:...\n"); printf(" The first 2 colors are the CPU art color and the next 2 colors are the text colors\n"); diff --git a/src/common/printer.c b/src/common/printer.c index d694bc1..b7a7604 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -520,10 +520,8 @@ bool print_cpufetch_x86(struct cpuInfo* cpu, STYLE s, struct colors* cs) { #ifdef ARCH_PPC void print_algorithm_ppc(struct ascii* art, int n) { for(int i=0; i < LINE_SIZE; i++) { - if(art->art[n][i] == '@') + if(art->art[n][i] == '#') printf("%s%c%s", art->color1_ascii, art->ascii_chars[0], art->reset); - else if(art->art[n][i] == '#') - printf("%s%c%s", art->color2_ascii, art->ascii_chars[1], art->reset); else printf("%c",art->art[n][i]); } diff --git a/src/common/printer.h b/src/common/printer.h index d3df19a..410449e 100644 --- a/src/common/printer.h +++ b/src/common/printer.h @@ -13,6 +13,7 @@ typedef int STYLE; #define COLOR_DEFAULT_INTEL "15,125,194:230,230,230:40,150,220:230,230,230" #define COLOR_DEFAULT_AMD "250,250,250:0,154,102:250,250,250:0,154,102" +#define COLOR_DEFAULT_IBM "92,119,172:92,119,172:240,240,240:92,119,172" #define COLOR_DEFAULT_ARM "0,145,189:0,145,189:240,240,240:0,145,189" #ifdef ARCH_X86