mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
Logos color
This commit is contained in:
14
ascii.h
14
ascii.h
@@ -10,12 +10,12 @@
|
|||||||
#define AMD4 " \0"
|
#define AMD4 " \0"
|
||||||
#define AMD5 " \0"
|
#define AMD5 " \0"
|
||||||
#define AMD6 " \0"
|
#define AMD6 " \0"
|
||||||
#define AMD7 " @@@@ @@@% @@@. @@@@@@@@( .############ \0"
|
#define AMD7 " @@@@ @@@ @@@ @@@@@@@@ ############ \0"
|
||||||
#define AMD8 " @@@@@@ @@@@@ %@@@@. @@@ @@@@ .((((((#### \0"
|
#define AMD8 " @@@@@@ @@@@@ @@@@ @@@ @@@@ ########## \0"
|
||||||
#define AMD9 " @@@ @@@ @@@/@@@@@@&@@. @@@ %@@% # #### \0"
|
#define AMD9 " @@@ @@@ @@@@@@@@@@@@@ @@@ @@ # #### \0"
|
||||||
#define AMD10 " @@@, (@@# @@@ @@@/ @@@. @@@ .@@@ ### #### \0"
|
#define AMD10 " @@@ @@@ @@@ @@@ @@@ @@@ @@@ ### #### \0"
|
||||||
#define AMD11 " ,@@@@@@@@@@, @@@ @@@. @@@ @@@ #### #### \0"
|
#define AMD11 " @@@@@@@@@@@@ @@@ @@@ @@@ @@@ #### ## ### \0"
|
||||||
#define AMD12 " @@@ @@@ @@@ @@@. @@@@@@@@@& #######/ .## \0"
|
#define AMD12 " @@@ @@@ @@@ @@@ @@@@@@@@@ ######## ## \0"
|
||||||
#define AMD13 " \0"
|
#define AMD13 " \0"
|
||||||
#define AMD14 " \0"
|
#define AMD14 " \0"
|
||||||
#define AMD15 " \0"
|
#define AMD15 " \0"
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#define INTEL12 "## ### ### ### ### ### ### ##### \0"
|
#define INTEL12 "## ### ### ### ### ### ### ##### \0"
|
||||||
#define INTEL13 "## ## ### ### ##### ######### ## ### \0"
|
#define INTEL13 "## ## ### ### ##### ######### ## ### \0"
|
||||||
#define INTEL14 "### \0"
|
#define INTEL14 "### \0"
|
||||||
#define INTEL15 "(### \0"
|
#define INTEL15 " ### \0"
|
||||||
#define INTEL16 " #### #### \0"
|
#define INTEL16 " #### #### \0"
|
||||||
#define INTEL17 " ##### ########## \0"
|
#define INTEL17 " ##### ########## \0"
|
||||||
#define INTEL18 " ########## ################ \0"
|
#define INTEL18 " ########## ################ \0"
|
||||||
|
|||||||
67
printer.c
67
printer.c
@@ -5,13 +5,26 @@
|
|||||||
#include "printer.h"
|
#include "printer.h"
|
||||||
#include "ascii.h"
|
#include "ascii.h"
|
||||||
|
|
||||||
|
#define COL_INTEL_1 "\x1b[34;1m"
|
||||||
|
#define COL_INTEL_2 "\x1b[37;1m"
|
||||||
|
#define COL_AMD_1 "\x1b[30;1m"
|
||||||
|
#define COL_AMD_2 "\x1b[32;1m"
|
||||||
|
#define RESET "\x1b[0m"
|
||||||
|
|
||||||
struct ascii {
|
struct ascii {
|
||||||
char art[NUMBER_OF_LINES][LINE_SIZE];
|
char art[NUMBER_OF_LINES][LINE_SIZE];
|
||||||
|
char color1[10];
|
||||||
|
char color2[10];
|
||||||
|
VENDOR vendor;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ascii* set_ascii(VENDOR cpuVendor) {
|
struct ascii* set_ascii(VENDOR cpuVendor) {
|
||||||
struct ascii* art = malloc(sizeof(struct ascii));
|
struct ascii* art = malloc(sizeof(struct ascii));
|
||||||
|
art->vendor = cpuVendor;
|
||||||
if(cpuVendor == VENDOR_INTEL) {
|
if(cpuVendor == VENDOR_INTEL) {
|
||||||
|
strcpy(art->color1,COL_INTEL_1);
|
||||||
|
strcpy(art->color2,COL_INTEL_2);
|
||||||
|
|
||||||
strcpy(art->art[0],INTEL1);
|
strcpy(art->art[0],INTEL1);
|
||||||
strcpy(art->art[1],INTEL2);
|
strcpy(art->art[1],INTEL2);
|
||||||
strcpy(art->art[2],INTEL3);
|
strcpy(art->art[2],INTEL3);
|
||||||
@@ -34,6 +47,9 @@ struct ascii* set_ascii(VENDOR cpuVendor) {
|
|||||||
strcpy(art->art[19],INTEL20);
|
strcpy(art->art[19],INTEL20);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
strcpy(art->color1,COL_AMD_1);
|
||||||
|
strcpy(art->color2,COL_AMD_2);
|
||||||
|
|
||||||
strcpy(art->art[0],AMD1);
|
strcpy(art->art[0],AMD1);
|
||||||
strcpy(art->art[1],AMD2);
|
strcpy(art->art[1],AMD2);
|
||||||
strcpy(art->art[2],AMD3);
|
strcpy(art->art[2],AMD3);
|
||||||
@@ -59,5 +75,54 @@ struct ascii* set_ascii(VENDOR cpuVendor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void print_ascii(struct ascii* art, int n) {
|
void print_ascii(struct ascii* art, int n) {
|
||||||
printf("%s",art->art[n]);
|
int flag = BOOLEAN_FALSE;
|
||||||
|
|
||||||
|
if(art->vendor == VENDOR_INTEL) {
|
||||||
|
/*** PRINT ASCII WITH SHADOW ***/
|
||||||
|
for(int i=0;i<LINE_SIZE;i++) {
|
||||||
|
if(flag) {
|
||||||
|
if(art->art[n][i] == ' ') {
|
||||||
|
flag = BOOLEAN_FALSE;
|
||||||
|
printf("%c",art->art[n][i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("%s%c" RESET,art->color1,art->art[n][i]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(art->art[n][i] != ' ') {
|
||||||
|
flag = BOOLEAN_TRUE;
|
||||||
|
printf("%s%c" RESET,art->color2,art->art[n][i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("%c",art->art[n][i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/*** PRINT TEXT AND LOGO IN DIFFERENT COLOR ***/
|
||||||
|
for(int i=0;i<LINE_SIZE;i++) {
|
||||||
|
if(art->art[n][i] == '@')
|
||||||
|
printf("%s%c" RESET,art->color1,art->art[n][i]);
|
||||||
|
else if(art->art[n][i] == '#')
|
||||||
|
printf("%s%c" RESET,art->color2,art->art[n][i]);
|
||||||
|
else
|
||||||
|
printf("%c",art->art[n][i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*** PRINT ASCII SIMPLE ***/
|
||||||
|
/*
|
||||||
|
void print_ascii(struct ascii* art, int n) {
|
||||||
|
int flag = BOOLEAN_FALSE;
|
||||||
|
|
||||||
|
for(int i=0;i<LINE_SIZE;i++) {
|
||||||
|
if(art->art[n][i] != ' ')
|
||||||
|
printf(BLUE "%c" RESET,art->art[n][i]);
|
||||||
|
else
|
||||||
|
printf("%c",art->art[n][i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ struct ascii;
|
|||||||
struct ascii* set_ascii(VENDOR cpuVendor);
|
struct ascii* set_ascii(VENDOR cpuVendor);
|
||||||
void print_ascii(struct ascii* art, int n);
|
void print_ascii(struct ascii* art, int n);
|
||||||
|
|
||||||
|
#define BOOLEAN_TRUE 1
|
||||||
|
#define BOOLEAN_FALSE 0
|
||||||
|
|
||||||
#define TITLE_NAME "Name: "
|
#define TITLE_NAME "Name: "
|
||||||
#define TITLE_ARCH "Arch: "
|
#define TITLE_ARCH "Arch: "
|
||||||
#define TITLE_FREQUENCY "Frequency: "
|
#define TITLE_FREQUENCY "Frequency: "
|
||||||
|
|||||||
Reference in New Issue
Block a user