mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-02 03:14:15 +01:00
Fastfetch: add option --bright-color
This commit is contained in:
@@ -34,6 +34,7 @@ Features:
|
||||
* Add new option `--temperature-unit`
|
||||
* Better CPU and Host detection for Android (Android)
|
||||
* Support yakuake terminal version & font detection (Terminal, Linux)
|
||||
* Add new option `--bright-color` which can be used to disable the default bright color of keys, title and ASCII logo.
|
||||
|
||||
Bugfixes:
|
||||
* Fix possible hanging (TerminalFont, #493)
|
||||
|
||||
@@ -304,6 +304,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"brightColor": {
|
||||
"title": "Set if the keys, title and ASCII logo should be printed in bright color",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"binaryPrefix": {
|
||||
"type": "string",
|
||||
"title": "Set the binary prefix to used when printing bytes",
|
||||
|
||||
@@ -35,6 +35,7 @@ static void defaultConfig(void)
|
||||
|
||||
ffStrbufInit(&instance.config.colorKeys);
|
||||
ffStrbufInit(&instance.config.colorTitle);
|
||||
instance.config.brightColor = true;
|
||||
ffStrbufInitStatic(&instance.config.keyValueSeparator, ": ");
|
||||
instance.config.processingTimeout = 1000;
|
||||
|
||||
|
||||
@@ -379,6 +379,8 @@ const char* ffParseDisplayJsonConfig(void)
|
||||
else
|
||||
return "display.color must be either a string or an object";
|
||||
}
|
||||
else if (ffStrEqualsIgnCase(key, "brightColor"))
|
||||
config->brightColor = yyjson_get_bool(val);
|
||||
else if (ffStrEqualsIgnCase(key, "binaryPrefix"))
|
||||
{
|
||||
int value;
|
||||
|
||||
@@ -12,7 +12,10 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFstrb
|
||||
|
||||
if(!instance.config.pipe)
|
||||
{
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
if (instance.config.brightColor)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
|
||||
if(customKeyColor != NULL && customKeyColor->length > 0)
|
||||
ffPrintColor(customKeyColor);
|
||||
else
|
||||
|
||||
@@ -58,6 +58,7 @@ Display options:
|
||||
-s,--structure <structure>: Set the structure of the fetch. Must be a colon separated list of keys. Use "fastfetch --list-modules" to see the ones available.
|
||||
--color-keys <color>: Set the color of the keys
|
||||
--color-title <color>: Set the color of the title
|
||||
--bright-color <?value>: Set if the keys, title and ASCII logo should be printed in bright color. Default is true
|
||||
-c,--color <color>: Set the color of both the keys and title
|
||||
--separator <str>: Set the separator between key and value. Default is a colon with a space
|
||||
--set <key=value>: Hard set the value of a key
|
||||
|
||||
@@ -906,6 +906,8 @@ static void parseOption(FFdata* data, const char* key, const char* value)
|
||||
optionCheckString(key, value, &instance.config.colorTitle);
|
||||
ffOptionParseColor(value, &instance.config.colorTitle);
|
||||
}
|
||||
else if(ffStrEqualsIgnCase(key, "--bright-color"))
|
||||
instance.config.brightColor = ffOptionParseBoolean(value);
|
||||
else if(ffStrEqualsIgnCase(key, "-c") || ffStrEqualsIgnCase(key, "--color"))
|
||||
{
|
||||
optionCheckString(key, value, &instance.config.colorKeys);
|
||||
|
||||
@@ -39,6 +39,8 @@ typedef struct FFconfig
|
||||
FFstrbuf colorKeys;
|
||||
FFstrbuf colorTitle;
|
||||
|
||||
bool brightColor;
|
||||
|
||||
FFstrbuf keyValueSeparator;
|
||||
|
||||
bool showErrors;
|
||||
|
||||
+7
-7
@@ -30,12 +30,12 @@ const FFlogo ffLogoBuiltins[] = {
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ALMALINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_MODE_BOLD FF_COLOR_FG_YELLOW,
|
||||
FF_COLOR_FG_LIGHT_YELLOW,
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_MODE_BOLD FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_LIGHT_GREEN,
|
||||
FF_COLOR_FG_CYAN,
|
||||
},
|
||||
.colorKeys = FF_COLOR_MODE_BOLD FF_COLOR_FG_YELLOW,
|
||||
.colorKeys = FF_COLOR_FG_YELLOW,
|
||||
.colorTitle = FF_COLOR_FG_RED,
|
||||
},
|
||||
// Alpine
|
||||
@@ -416,7 +416,7 @@ const FFlogo ffLogoBuiltins[] = {
|
||||
.names = {"Astra", "Astra Linux", "astralinux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ASTRA_LINUX,
|
||||
.colors = {
|
||||
FF_COLOR_MODE_BOLD FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_LIGHT_RED,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_RED,
|
||||
@@ -1565,9 +1565,9 @@ const FFlogo ffLogoBuiltins[] = {
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_HYBRID,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_MODE_BOLD FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_LIGHT_BLUE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_MODE_BOLD FF_COLOR_FG_BLUE,
|
||||
.colorKeys = FF_COLOR_FG_LIGHT_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_BLUE,
|
||||
},
|
||||
// HydroOS
|
||||
@@ -2735,7 +2735,7 @@ const FFlogo ffLogoBuiltins[] = {
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_PENGWIN,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
FF_COLOR_MODE_BOLD FF_COLOR_FG_MAGENTA,
|
||||
FF_COLOR_FG_LIGHT_MAGENTA,
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
},
|
||||
},
|
||||
|
||||
+7
-2
@@ -19,7 +19,10 @@ typedef enum FFLogoSize
|
||||
static void ffLogoPrintCharsRaw(const char* data, size_t length)
|
||||
{
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
|
||||
if (instance.config.brightColor)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
|
||||
ffPrintCharTimes('\n', options->paddingTop);
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
fwrite(data, length, 1, stdout);
|
||||
@@ -34,7 +37,9 @@ void ffLogoPrintChars(const char* data, bool doColorReplacement)
|
||||
|
||||
uint32_t currentlineLength = 0;
|
||||
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
if (instance.config.brightColor)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
|
||||
ffPrintCharTimes('\n', options->paddingTop);
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ static inline void printTitlePart(const FFstrbuf* content, const FFstrbuf* color
|
||||
{
|
||||
if(!instance.config.pipe)
|
||||
{
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
if (instance.config.brightColor)
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
ffPrintColor(color->length > 0 ? color : &instance.config.colorTitle);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user