mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Percent: tidy
This commit is contained in:
@@ -89,9 +89,9 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config
|
||||
|
||||
if (colored && !options->pipe)
|
||||
{
|
||||
const char* colorGreen = instance.config.display.percentColorGreen.chars;
|
||||
const char* colorYellow = instance.config.display.percentColorYellow.chars;
|
||||
const char* colorRed = instance.config.display.percentColorRed.chars;
|
||||
const char* colorGreen = options->percentColorGreen.chars;
|
||||
const char* colorYellow = options->percentColorYellow.chars;
|
||||
const char* colorRed = options->percentColorRed.chars;
|
||||
|
||||
if(percent != percent)
|
||||
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
|
||||
|
||||
@@ -452,6 +452,17 @@ void ffOptionsGenerateDisplayJsonConfig(FFOptionsDisplay* options, yyjson_mut_do
|
||||
yyjson_mut_obj_add_uint(doc, percent, "type", options->percentType);
|
||||
if (options->percentNdigits != defaultOptions.percentNdigits)
|
||||
yyjson_mut_obj_add_uint(doc, percent, "ndigits", options->percentNdigits);
|
||||
{
|
||||
yyjson_mut_val* color = yyjson_mut_obj(doc);
|
||||
if (!ffStrbufEqual(&options->percentColorGreen, &defaultOptions.percentColorGreen))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "green", &options->percentColorGreen);
|
||||
if (!ffStrbufEqual(&options->percentColorYellow, &defaultOptions.percentColorYellow))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "yellow", &options->percentColorYellow);
|
||||
if (!ffStrbufEqual(&options->percentColorRed, &defaultOptions.percentColorRed))
|
||||
yyjson_mut_obj_add_strbuf(doc, color, "red", &options->percentColorRed);
|
||||
if (yyjson_mut_obj_size(color) > 0)
|
||||
yyjson_mut_obj_add_val(doc, percent, "color", color);
|
||||
}
|
||||
if (yyjson_mut_obj_size(percent) > 0)
|
||||
yyjson_mut_obj_add_val(doc, obj, "percent", percent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user