mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-08 06:00:08 +01:00
Colors: add --colors-padding-left
This commit is contained in:
@@ -11,6 +11,9 @@ void ffPrintColors(FFinstance* instance, FFColorsOptions* options)
|
||||
|
||||
ffLogoPrintLine(instance);
|
||||
|
||||
if(options->paddingLeft > 0)
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
|
||||
if (options->symbol == FF_COLORS_SYMBOL_BLOCK)
|
||||
{
|
||||
// 4%d: Set the background color
|
||||
@@ -22,6 +25,9 @@ void ffPrintColors(FFinstance* instance, FFColorsOptions* options)
|
||||
|
||||
ffLogoPrintLine(instance);
|
||||
|
||||
if(options->paddingLeft > 0)
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
|
||||
// 1: Set everything to bolt. This causes normal colors on some systems to be bright.
|
||||
// 4%d: Set the backgound to the not bright color
|
||||
// 3%d: Set the foreground to the not bright color
|
||||
@@ -53,6 +59,7 @@ void ffInitColorsOptions(FFColorsOptions* options)
|
||||
{
|
||||
options->moduleName = FF_COLORS_MODULE_NAME;
|
||||
options->symbol = FF_COLORS_SYMBOL_BLOCK;
|
||||
options->paddingLeft = 0;
|
||||
}
|
||||
|
||||
bool ffParseColorsCommandOptions(FFColorsOptions* options, const char* key, const char* value)
|
||||
@@ -74,6 +81,12 @@ bool ffParseColorsCommandOptions(FFColorsOptions* options, const char* key, cons
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "padding-left"))
|
||||
{
|
||||
options->paddingLeft = ffOptionParseUInt32(key, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -115,6 +128,12 @@ void ffParseColorsJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "paddingLeft"))
|
||||
{
|
||||
options.paddingLeft = (uint32_t) yyjson_get_uint(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintErrorString(instance, FF_COLORS_MODULE_NAME, 0, NULL, NULL, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@
|
||||
void ffPrintColors(FFinstance* instance, FFColorsOptions* options);
|
||||
void ffInitColorsOptions(FFColorsOptions* options);
|
||||
void ffDestroyColorsOptions(FFColorsOptions* options);
|
||||
bool ffParseColorsCommandOptions(FFColorsOptions* options, const char* key, const char* value);
|
||||
void ffParseColorsJsonObject(FFinstance* instance, yyjson_val* module);
|
||||
|
||||
@@ -18,4 +18,5 @@ typedef struct FFColorsOptions
|
||||
{
|
||||
const char* moduleName;
|
||||
FFColorssymbol symbol;
|
||||
uint32_t paddingLeft;
|
||||
} FFColorsOptions;
|
||||
|
||||
Reference in New Issue
Block a user