mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Separator: add --separator-output-color
This commit is contained in:
@@ -1772,6 +1772,9 @@
|
||||
"description": "Set the string to be printed",
|
||||
"type": "string",
|
||||
"default": "-"
|
||||
},
|
||||
"outputColor": {
|
||||
"$ref": "#/$defs/outputColor"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -921,6 +921,14 @@
|
||||
"default": "-"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "separator-output-color",
|
||||
"desc": "Set the color of the separator module",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "disk-folders",
|
||||
"desc": "A colon (semicolon on Windows) separated list of folder paths to be detected",
|
||||
|
||||
@@ -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