Percent: tidy

This commit is contained in:
李通洲
2024-02-26 10:23:00 +08:00
parent 42b756e703
commit 1c87693867
2 changed files with 14 additions and 3 deletions
+11
View File
@@ -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);
}