diff --git a/.editorconfig b/.editorconfig index a1c08b72..91ac9d2a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,8 +7,8 @@ tab_width = 4 insert_final_newline = true trim_trailing_whitespace = true -[*.md] +[*.{md,fflogo}] trim_trailing_whitespace = false -[*.txt] +[*.{txt,fflogo}] insert_final_newline = false diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 6f0ff1d8..be873476 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -5,9 +5,7 @@ Here i just add things that are easy to forget. ## Features i am planning to implement -- [ ] Support overwriting logo colors (e.g. --color-1 35 --color-2 31) - [ ] Support for color name mapping (e.g. --color red) -- [ ] Support for colors in user provided logo files (requires point 1 to be implemented) - [ ] Support for printing images as ascii art logos (using imlib2 and libcaca probably) - [ ] Support for printing images in terminals that support it - [ ] Better documentation (especially default config file and the various --help options. Colored output?) diff --git a/src/common/init.c b/src/common/init.c index 236fcc66..eb286950 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -114,6 +114,10 @@ static void defaultConfig(FFinstance* instance) instance->config.allowSlowOperations = false; instance->config.disableLinewrap = true; instance->config.hideCursor = true; + instance->config.userLogoIsRaw = false; + + for(uint8_t i = 0; i < (uint8_t) FASTFETCH_LOGO_MAX_COLORS; ++i) + ffStrbufInit(&instance->config.logoColors[i]); ffLoadLogo(instance); diff --git a/src/common/io.c b/src/common/io.c index e500a710..f485d9be 100644 --- a/src/common/io.c +++ b/src/common/io.c @@ -12,7 +12,7 @@ void ffPrintLogoAndKey(FFinstance* instance, const char* moduleName, uint8_t mod ffPrintLogoLine(instance); fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout); - ffStrbufWriteTo(&instance->config.color, stdout); + ffPrintColor(&instance->config.color); if(customKeyFormat == NULL || customKeyFormat->length == 0) { @@ -490,3 +490,10 @@ void ffSuppressIO(bool suppress) dup2(suppress ? nullFile : origOut, STDOUT_FILENO); dup2(suppress ? nullFile : origErr, STDERR_FILENO); } + +void ffPrintColor(const FFstrbuf* colorValue) +{ + fputs("\033[", stdout); + ffStrbufWriteTo(colorValue, stdout); + fputc('m', stdout); +} diff --git a/src/common/logo.c b/src/common/logo.c index 475bbde9..3bec52ba 100644 --- a/src/common/logo.c +++ b/src/common/logo.c @@ -7,7 +7,7 @@ #define FF_LOGO_INIT static FFlogo logo; static bool init = false; if(init) return &logo; init = true; logo.isFromUser = false; #define FF_LOGO_NAMES(...) static const char* names[] = (const char*[]) { __VA_ARGS__, NULL }; logo.names = names; #define FF_LOGO_LINES(x) logo.lines = x; -#define FF_LOGO_COLORS(...) static const char* colors[] = (const char*[]) { __VA_ARGS__, NULL }; logo.colors = colors; +#define FF_LOGO_COLORS(...) static const char* colors[] = (const char*[]) { __VA_ARGS__, NULL }; logo.builtinColors = colors; #define FF_LOGO_RETURN return &logo; static const FFlogo* getLogoUnknown() @@ -73,7 +73,7 @@ static const FFlogo* getLogoArch() "$1.` `/"; ) FF_LOGO_COLORS( - "\033[36m" //cyan + "36" //cyan ) FF_LOGO_RETURN } @@ -92,7 +92,7 @@ static const FFlogo* getLogoArchSmall() "$1/_-'' ''-_\\" ) FF_LOGO_COLORS( - "\033[36m" //cyan + "36" //cyan ) FF_LOGO_RETURN } @@ -124,7 +124,7 @@ static const FFlogo* getLogoArtix() "$1'` `'"; ) FF_LOGO_COLORS( - "\033[36m" //cyan + "36" //cyan ) FF_LOGO_RETURN } @@ -143,7 +143,7 @@ static const FFlogo* getLogoArtixSmall() "$1/.,'` `'.\\" ) FF_LOGO_COLORS( - "\033[36m" //cyan + "36" //cyan ) FF_LOGO_RETURN } @@ -175,8 +175,8 @@ static const FFlogo* getLogoArcoLinux() "$1 ooooooooo. $2 -ooooooooo"; ) FF_LOGO_COLORS( - "\033[34m", //blue - "\033[32m" //green + "34", //blue + "32" //green ) FF_LOGO_RETURN } @@ -203,8 +203,8 @@ static const FFlogo* getLogoCelOS() "$1 `.:/+ooooo+:-` " ) FF_LOGO_COLORS( - "\033[35m", //magenta - "\033[30m" //black + "35", //magenta + "30" //black ) FF_LOGO_RETURN } @@ -235,11 +235,11 @@ static const FFlogo* getLogoCentOS() "$1 '' " ) FF_LOGO_COLORS( - "\033[33m", //yellow - "\033[32m", //green - "\033[34m", //blue - "\033[35m", //magenta - "\033[37m" //white + "33", //yellow + "32", //green + "34", //blue + "35", //magenta + "37" //white ) FF_LOGO_RETURN } @@ -258,10 +258,10 @@ static const FFlogo* getLogoCentOSSmall() "$2 v " ) FF_LOGO_COLORS( - "\033[33m", //yellow - "\033[32m", //green - "\033[34m", //blue - "\033[35m" //magenta + "33", //yellow + "32", //green + "34", //blue + "35" //magenta ) FF_LOGO_RETURN } @@ -290,8 +290,8 @@ static const FFlogo* getLogoDebian() "$2 `\"\"\" " ) FF_LOGO_COLORS( - "\033[31m", //red - "\033[37m" //white + "31", //red + "37" //white ) FF_LOGO_RETURN } @@ -309,7 +309,7 @@ static const FFlogo* getLogoDebianSmall() "$1 --_ " ) FF_LOGO_COLORS( - "\033[31m" //red + "31" //red ) FF_LOGO_RETURN } @@ -340,8 +340,8 @@ static const FFlogo* getLogoFedora() "$1 ':cccccccccccccccc::;,. " ) FF_LOGO_COLORS( - "\033[34m", //blue - "\033[37m" //white + "34", //blue + "37" //white ) FF_LOGO_RETURN } @@ -362,7 +362,7 @@ static const FFlogo* getLogoFedoraSmall() "$1 ''''' " ) FF_LOGO_COLORS( - "\033[34m" //blue + "34" //blue ) FF_LOGO_RETURN } @@ -391,8 +391,8 @@ static const FFlogo* getLogoFedoraOld() "$1:---------------------:// " ) FF_LOGO_COLORS( - "\033[34m", //blue - "\033[37m" //white + "34", //blue + "37" //white ) FF_LOGO_RETURN } @@ -422,7 +422,7 @@ static const FFlogo* getLogoGaruda() "$1 .d988999889889899dd. " ) FF_LOGO_COLORS( - "\033[31m" //red + "31" //red ) FF_LOGO_RETURN } @@ -452,8 +452,8 @@ static const FFlogo* getLogoGentoo() "$1 `-//////:--. " ) FF_LOGO_COLORS( - "\033[35m", //magenta - "\033[37m" //white + "35", //magenta + "37" //white ) FF_LOGO_RETURN } @@ -472,8 +472,8 @@ static const FFlogo* getLogoGentooSmall() "$2\\____- " ) FF_LOGO_COLORS( - "\033[35m", //magenta - "\033[37m" //white + "35", //magenta + "37" //white ) FF_LOGO_RETURN } @@ -499,7 +499,7 @@ static const FFlogo* getLogoManjaro() "$1████████ ████████ ████████" ) FF_LOGO_COLORS( - "\033[32m" //green + "32" //green ) FF_LOGO_RETURN } @@ -518,7 +518,7 @@ static const FFlogo* getLogoManjaroSmall() "$1|||| |||| ||||" ) FF_LOGO_COLORS( - "\033[32m" //green + "32" //green ) FF_LOGO_RETURN } @@ -549,8 +549,8 @@ static const FFlogo* getLogoMint() "$2 ``-:::::-`` " ) FF_LOGO_COLORS( - "\033[32m", //green - "\033[37m" //white + "32", //green + "37" //white ) FF_LOGO_RETURN } @@ -569,8 +569,8 @@ static const FFlogo* getLogoMintSmall() "$1 \\_________/" ) FF_LOGO_COLORS( - "\033[32m", //green - "\033[37m" //white + "32", //green + "37" //white ) FF_LOGO_RETURN } @@ -598,8 +598,8 @@ static const FFlogo* getLogoMintOld() "$1 .MMMMMMMMMMMMMMMMMMM " ) FF_LOGO_COLORS( - "\033[32m", //green - "\033[37m" //white + "32", //green + "37" //white ) FF_LOGO_RETURN } @@ -631,8 +631,8 @@ static const FFlogo* getLogoPop() "$1 ///////////// " ) FF_LOGO_COLORS( - "\033[36m", //cyan - "\033[37m" //white + "36", //cyan + "37" //white ) FF_LOGO_RETURN } @@ -652,7 +652,7 @@ static const FFlogo* getLogoPopSmall() "$1 (___________)` " ) FF_LOGO_COLORS( - "\033[36m" //cyan + "36" //cyan ) FF_LOGO_RETURN } @@ -684,8 +684,8 @@ static const FFlogo* getLogoUbuntu() "$1 .-/+oossssoo+/-. " ) FF_LOGO_COLORS( - "\033[31m", //red - "\033[37m" //white + "31", //red + "37" //white ) FF_LOGO_RETURN } @@ -703,7 +703,7 @@ static const FFlogo* getLogoUbuntuSmall() "$1 ---(_)" ) FF_LOGO_COLORS( - "\033[31m" //red + "31" //red ) FF_LOGO_RETURN } @@ -733,8 +733,8 @@ static const FFlogo* getLogoVoid() "$1 -~|{*l}*|~ " ) FF_LOGO_COLORS( - "\033[32m", //green - "\033[30m" //black + "32", //green + "30" //black ) FF_LOGO_RETURN } @@ -753,7 +753,7 @@ static const FFlogo* getLogoVoidSmall() "$1 -_______\\ " ) FF_LOGO_COLORS( - "\033[32m" //green + "32" //green ) FF_LOGO_RETURN } @@ -813,11 +813,24 @@ static bool logoHasName(const FFlogo* logo, const char* name) return false; } -static inline void setLogo(FFinstance* instance, const FFlogo* logo) +static void setLogo(FFinstance* instance, const FFlogo* logo) { instance->config.logo = logo; instance->state.logoWidth = 0; instance->state.logoLinesIndex = logo->lines; + + const char** colors = logo->builtinColors; + int counter = 0; + + while(!logo->isFromUser && *colors != NULL) + { + ffStrbufSetS(&instance->config.logoColors[counter], *colors); + ++counter; + ++colors; + } + + for(; counter < FASTFETCH_LOGO_MAX_COLORS; ++counter) + ffStrbufClear(&instance->config.logoColors[counter]); } static bool loadLogoSet(FFinstance* instance, const char* name) @@ -858,11 +871,7 @@ void ffLoadLogoSet(FFinstance* instance, const char* logo) static FFlogo dummyLogo; dummyLogo.isFromUser = true; - dummyLogo.colors = getLogoNone()->colors; dummyLogo.lines = logoChars.chars; - static const char* NULLSTR = NULL; - dummyLogo.names = &NULLSTR; - setLogo(instance, &dummyLogo); } @@ -959,18 +968,48 @@ void ffPrintLogoLine(FFinstance* instance) { //Get the current char char current = *instance->state.logoLinesIndex; - ++instance->state.logoLinesIndex; + + //We have a color encoding directly in the logo. Print it and increase colorPlaceholdersLength + if(instance->config.logo->isFromUser && current == '\033' && *(instance->state.logoLinesIndex + 1) == '[') + { + //At this point we don't know if the start ends with a 'm', so we need to buffer + FFstrbuf colorBuffer; + ffStrbufInit(&colorBuffer); + + char* indexCopy = instance->state.logoLinesIndex; + while(*indexCopy != '\n' && *indexCopy != '\0') + { + ffStrbufAppendC(&colorBuffer, *indexCopy); + + if(*indexCopy == 'm') + break; + + ++indexCopy; + } + + //It was a color encoding, write it and increase colorPlaceholdersLength + if(*indexCopy == 'm') + { + ffStrbufWriteTo(&colorBuffer, stdout); + colorPlaceholdersLength += colorBuffer.length; + instance->state.logoLinesIndex = indexCopy + 1; // + 1 to skip the 'm' + current = *instance->state.logoLinesIndex; + } + + ffStrbufDestroy(&colorBuffer); + } //Not a color placeholder, just print it. User files don't support colors this way. - if(current != '$' || instance->config.logo->isFromUser) + if(current != '$' || instance->config.userLogoIsRaw) { LOGO_LINE_PRINT_CHAR(current, cut); + ++instance->state.logoLinesIndex; continue; } //Skip the dollar sign - current = *instance->state.logoLinesIndex; ++instance->state.logoLinesIndex; + current = *instance->state.logoLinesIndex; //We have a dollar sign at the end of the line. Just print it. if(current == '\n' || current == '\0') @@ -980,11 +1019,15 @@ void ffPrintLogoLine(FFinstance* instance) break; } + //We definitly have something to print and are not at the end of the line. + //Already increase it here, so i don't have to write it multiple times + ++instance->state.logoLinesIndex; + //We have two dollar signs. Print one. if(current == '$') { - ++colorPlaceholdersLength; LOGO_LINE_PRINT_CHAR('$', cut); + ++colorPlaceholdersLength; continue; } @@ -992,7 +1035,7 @@ void ffPrintLogoLine(FFinstance* instance) int index = ((int) current) - 49; //Invalid index, just print the $ and the following char - if(index < 0 || index > 9) + if(index < 0 || index >= FASTFETCH_LOGO_MAX_COLORS) { LOGO_LINE_PRINT_CHAR('$', cut); LOGO_LINE_PRINT_CHAR(current, cut); @@ -1002,9 +1045,11 @@ void ffPrintLogoLine(FFinstance* instance) //Index can maximal be 9, so we have exactly two chars for the color colorPlaceholdersLength += 2; - //Print the color, if color support is on. - if(instance->config.colorLogo) - fputs(instance->config.logo->colors[index], stdout); + // If we don't color our logo, skip it + if(!instance->config.colorLogo) + continue; + + ffPrintColor(&instance->config.logoColors[index]); } //Reset out bold logo @@ -1045,7 +1090,7 @@ void ffPrintLogos(FFinstance* instance) while(*methods != NULL) { setLogo(instance, (*methods)()); - printf(FASTFETCH_TEXT_MODIFIER_BOLT"%s%s"FASTFETCH_TEXT_MODIFIER_RESET":\n", instance->config.colorLogo ? instance->config.logo->colors[0] : "", instance->config.logo->names[0]); + printf(FASTFETCH_TEXT_MODIFIER_BOLT"\033[%sm%s"FASTFETCH_TEXT_MODIFIER_RESET":\n", instance->config.colorLogo ? instance->config.logo->builtinColors[0] : "", instance->config.logo->names[0]); ffPrintRemainingLogo(instance); puts("\n"); ++methods; diff --git a/src/data/config.txt b/src/data/config.txt index 4855fcfd..302500dc 100644 --- a/src/data/config.txt +++ b/src/data/config.txt @@ -102,6 +102,24 @@ # Default is "-" #--separator-string - +# Logo color options: +# Overwrite a color in the logo. Also works for user provided logos. +# In the user logo, they replace $[1-9]. Use $$ to print a single $ sign. +# Must be linux console color codes. +# Default is the one specified by the logo. +# Use "fastfetch --help color" to learn more and see examples. +# Valid index range is [1-9]. +#--color-1 31 +#--color-2 32 +# [...] +#--color-9 39 + +# User logo raw option: +# Sets if color replacements should be performed on the user provided logo. +# Must be true or false. +# Default is true. +#--color-raw true + # Key options: # Sets the displayed key of a module # Can be any string. Some of theme take an argument like a format string. See "fastfetch --help format" for help. diff --git a/src/data/help.txt b/src/data/help.txt index cf79e2e3..64ae9f83 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -16,6 +16,7 @@ General options: --structure : sets the structure of the fetch. Must be a colon separated list of keys. Use "fastfetch --list-modules" to see the ones available. --set : hard set the value of a key -c , --color : sets the color of the keys. Must be a linux console color code (+) + --color-[1-9] : overwrites a color of the logo. Must be a linux console color code --spacing : sets the distance between logo and text -s , --separator : sets the separator between key and value. Default is a colon with a space -x , --offsetx : sets the x offset. Can be negative to cut the logo, but no more than logo width. @@ -28,6 +29,7 @@ General options: --allow-slow-operations : Allow operations that are usually very slow for more detailed output --disable-linewrap : Disable linewrap during the run --hide-cursor : Hide the cursor during the run + --logo-raw : Print a custom logo as is, without any color replacements Logo options: -l , --logo : sets the shown logo. Also changes the main color accordingly. This will also load file contents as logo if the given argument is a valid path. diff --git a/src/fastfetch.c b/src/fastfetch.c index 3f42828b..d00535a7 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -14,6 +14,7 @@ typedef struct FFdata FFvaluestore valuestore; FFstrbuf structure; FFstrbuf logoName; + FFstrbuf logoColors[FASTFETCH_LOGO_MAX_COLORS]; bool multithreading; } FFdata; @@ -632,6 +633,8 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con instance->config.disableLinewrap = optionParseBoolean(value); else if(strcasecmp(key, "--hide-cursor") == 0) instance->config.hideCursor = optionParseBoolean(value); + else if(strcasecmp(key, "--logo-raw") == 0) + instance->config.userLogoIsRaw = optionParseBoolean(value); else if(strcasecmp(key, "--structure") == 0) optionParseString(key, value, &data->structure); else if(strcasecmp(key, "-l") == 0 || strcasecmp(key, "--logo") == 0) @@ -639,16 +642,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con else if(strcasecmp(key, "-s") == 0 || strcasecmp(key, "--separator") == 0) optionParseString(key, value, &instance->config.separator); else if(strcasecmp(key, "-c") == 0 || strcasecmp(key, "--color") == 0) - { - if(value == NULL) - { - fprintf(stderr, "Error: usage: %s \n", key); - exit(477); - } - ffStrbufSetS(&instance->config.color, "\033["); - ffStrbufAppendS(&instance->config.color, value); - ffStrbufAppendC(&instance->config.color, 'm'); - } + optionParseString(key, value, &instance->config.color); else if(strcasecmp(key, "--os-format") == 0) optionParseString(key, value, &instance->config.osFormat); else if(strcasecmp(key, "--os-key") == 0) @@ -779,6 +773,20 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con instance->config.localIpShowIpV6 = optionParseBoolean(value); else if(strcasecmp(key, "--localip-show-loop") == 0) instance->config.localIpShowLoop = optionParseBoolean(value); + else if(strncasecmp(key, "--color-", 7) == 0 && key[8] != '\0' && key[9] == '\0') // matches "--color-*" + { + //Map the number to an array index, so that '1' -> 0, '2' -> 1, etc. + int index = (int)key[8] - 49; + + //Match only --color-[1-9] + if(index < 0 || index >= FASTFETCH_LOGO_MAX_COLORS) + { + fprintf(stderr, "Error: invalid --color-[1-9] index: %c\n", key[8]); + exit(472); + } + + optionParseString(key, value, &data->logoColors[index]); + } else { fprintf(stderr, "Error: unknown option: %s\n", key); @@ -922,6 +930,9 @@ int main(int argc, const char** argv) ffStrbufInitA(&data.logoName, 0); data.multithreading = true; + for(uint8_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS; i++) + ffStrbufInitA(&data.logoColors[i], 0); + parseDefaultConfigFile(&instance, &data); parseArguments(&instance, &data, argc, argv); @@ -931,7 +942,14 @@ int main(int argc, const char** argv) //If we haven't set key color, use primary color of logo if(instance.config.color.length == 0) - ffStrbufSetS(&instance.config.color, instance.config.logo->colors[0]); + ffStrbufSet(&instance.config.color, &instance.config.logoColors[0]); + + //Overwrite logo colors with custom colors + for(uint8_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS; i++) + { + if(data.logoColors[i].length > 0) + ffStrbufSet(&instance.config.logoColors[i], &data.logoColors[i]); + } //Start detection threads if(data.multithreading) @@ -943,6 +961,7 @@ int main(int argc, const char** argv) ffStart(&instance); + //Parse the structure and call the modules uint32_t startIndex = 0; while (startIndex < data.structure.length) { diff --git a/src/fastfetch.h b/src/fastfetch.h index 0618edc7..3811975c 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -26,17 +26,20 @@ static inline void ffUnused(int dummy, ...) { (void) dummy; } #define FASTFETCH_TEXT_MODIFIER_ERROR "\033[1;31m" #define FASTFETCH_TEXT_MODIFIER_RESET "\033[0m" +#define FASTFETCH_LOGO_MAX_COLORS 9 //two digits would make parsing much more complicated (index 1 - 9) + typedef struct FFlogo { const char** names; //Null terminated char* lines; - const char** colors; // colors[0] is used as key color bool isFromUser; + const char** builtinColors; // [0] is used as key color, if not user specified } FFlogo; typedef struct FFconfig { const FFlogo* logo; + FFstrbuf logoColors[FASTFETCH_LOGO_MAX_COLORS]; uint16_t logoKeySpacing; FFstrbuf separator; @@ -50,6 +53,7 @@ typedef struct FFconfig bool allowSlowOperations; bool disableLinewrap; bool hideCursor; + bool userLogoIsRaw; FFstrbuf osFormat; FFstrbuf osKey; @@ -331,6 +335,8 @@ void ffWriteFileContent(const char* fileName, const FFstrbuf* buffer); // Not thread safe! void ffSuppressIO(bool suppress); +void ffPrintColor(const FFstrbuf* colorValue); + // They return true if the file was found, independently if start was found // Buffers which already contain content are not overwritten // The last occurence of start in the first file will be the one used diff --git a/src/flashfetch.c b/src/flashfetch.c index 94def613..bcaa7f23 100644 --- a/src/flashfetch.c +++ b/src/flashfetch.c @@ -9,7 +9,7 @@ int main(int argc, char** argv) ffInitInstance(&instance); //This also applys default configuration to instance.config //ffLoadLogoSet(&instance, "my custom logo"); - ffStrbufSetS(&instance.config.color, instance.config.logo->colors[0]); //Use the primary color of the logo as key color + ffStrbufSetS(&instance.config.color, instance.config.logoColors[0].chars); //Use the primary color of the logo as key color //Multithreading --> better performance ffStartDetectionThreads(&instance); diff --git a/src/modules/battery.c b/src/modules/battery.c index 27572493..5500ea74 100644 --- a/src/modules/battery.c +++ b/src/modules/battery.c @@ -147,7 +147,7 @@ void ffPrintBattery(FFinstance* instance) return; } - for(uint8_t i = 0; i < dirs.length; i++) + for(uint8_t i = 0; i < (uint8_t) dirs.length; i++) { FFstrbuf* name = ffListGet(&dirs, i); ffStrbufAppend(&baseDir, name); diff --git a/src/modules/gpu.c b/src/modules/gpu.c index b8b6823b..b8030dd3 100644 --- a/src/modules/gpu.c +++ b/src/modules/gpu.c @@ -205,7 +205,7 @@ void ffPrintGPU(FFinstance* instance) vulkanFillGPUs(instance, &gpus); #endif - for(uint8_t i = 0; i < gpus.length; i++) + for(uint8_t i = 0; i < (uint8_t) gpus.length; i++) printGPUResult(instance, gpus.length == 1 ? 0 : i + 1, &cache, ffListGet(&gpus, i)); if(gpus.length == 0) diff --git a/src/modules/title.c b/src/modules/title.c index 29d9bf2b..9158105a 100644 --- a/src/modules/title.c +++ b/src/modules/title.c @@ -31,7 +31,7 @@ const FFTitleResult* ffDetectTitle(FFinstance* instance) static inline void printTitlePart(FFinstance* instance, const FFstrbuf* content) { fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout); - ffStrbufWriteTo(&instance->config.color, stdout); + ffPrintColor(&instance->config.color); ffStrbufWriteTo(content, stdout); fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout); } diff --git a/tests/testlogo-hardcolors.fflogo b/tests/testlogo-hardcolors.fflogo new file mode 100644 index 00000000..ab93080a --- /dev/null +++ b/tests/testlogo-hardcolors.fflogo @@ -0,0 +1,4 @@ + . + ... + .-|-. +.-| |-. \ No newline at end of file diff --git a/tests/testlogo-softcolors.fflogo b/tests/testlogo-softcolors.fflogo new file mode 100644 index 00000000..4e42ced7 --- /dev/null +++ b/tests/testlogo-softcolors.fflogo @@ -0,0 +1,4 @@ +$1 . +$1 ... +$1 .-|-. +$1.-| |-. \ No newline at end of file