mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Separator: add --separator-output-color
This commit is contained in:
@@ -9,4 +9,5 @@ typedef struct FFSeparatorOptions
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
|
||||
FFstrbuf string;
|
||||
FFstrbuf outputColor;
|
||||
} FFSeparatorOptions;
|
||||
|
||||
@@ -43,6 +43,8 @@ void ffPrintSeparator(FFSeparatorOptions* options)
|
||||
+ (fqdn ? platform->hostName.length : ffStrbufFirstIndexC(&platform->hostName, '.')); // host name
|
||||
ffLogoPrintLine();
|
||||
|
||||
if(options->outputColor.length)
|
||||
ffPrintColor(&options->outputColor);
|
||||
if(__builtin_expect(options->string.length == 1, 1))
|
||||
{
|
||||
ffPrintCharTimes(options->string.chars[0], titleLength);
|
||||
@@ -97,6 +99,12 @@ bool ffParseSeparatorCommandOptions(FFSeparatorOptions* options, const char* key
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "output-color"))
|
||||
{
|
||||
ffOptionParseColor(value, &options->outputColor);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,6 +124,12 @@ void ffParseSeparatorJsonObject(FFSeparatorOptions* options, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEndsWithIgnCase(key, "outputColor"))
|
||||
{
|
||||
ffOptionParseColor(yyjson_get_str(val), &options->outputColor);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_SEPARATOR_MODULE_NAME, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user