Skip to content

Commit

Permalink
Config: support more color prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed May 10, 2024
1 parent ce6b595 commit 3d4077c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 3 additions & 5 deletions doc/json_schema.json
Expand Up @@ -4,10 +4,8 @@
"colors": {
"type": "string",
"enum": [
"reset_", "bright_", "dim_",
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default",
"bright_black", "bright_red", "bright_green", "bright_yellow", "bright_blue", "bright_magenta", "bright_cyan", "bright_white",
"dim_black", "dim_red", "dim_green", "dim_yellow", "dim_blue", "dim_magenta", "dim_cyan", "dim_white"
"reset_", "bright_", "dim_", "italic_", "underline_", "blink_", "inverse_", "hidden_", "strike_", "light_",
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default"
]
},
"key": {
Expand All @@ -29,7 +27,7 @@
"type": "string"
},
"outputColor": {
"description": "Output color of the module",
"description": "Output color of the module. Left empty to use `display.color.output`",
"$ref": "#/$defs/colors"
},
"percent": {
Expand Down
6 changes: 6 additions & 0 deletions src/common/option.c
Expand Up @@ -158,6 +158,12 @@ void ffOptionParseColor(const char* value, FFstrbuf* buffer)
FF_APPEND_COLOR_CODE_COND(reset_, FF_COLOR_MODE_RESET)
else FF_APPEND_COLOR_CODE_COND(bright_, FF_COLOR_MODE_BOLD)
else FF_APPEND_COLOR_CODE_COND(dim_, FF_COLOR_MODE_DIM)
else FF_APPEND_COLOR_CODE_COND(italic_, FF_COLOR_MODE_ITALIC)
else FF_APPEND_COLOR_CODE_COND(underline_, FF_COLOR_MODE_UNDERLINE)
else FF_APPEND_COLOR_CODE_COND(blink_, FF_COLOR_MODE_BLINK)
else FF_APPEND_COLOR_CODE_COND(inverse_, FF_COLOR_MODE_INVERSE)
else FF_APPEND_COLOR_CODE_COND(hidden_, FF_COLOR_MODE_HIDDEN)
else FF_APPEND_COLOR_CODE_COND(strike_, FF_COLOR_MODE_STRIKETHROUGH)
else FF_APPEND_COLOR_CODE_COND(black, FF_COLOR_FG_BLACK)
else FF_APPEND_COLOR_CODE_COND(red, FF_COLOR_FG_RED)
else FF_APPEND_COLOR_CODE_COND(green, FF_COLOR_FG_GREEN)
Expand Down
2 changes: 1 addition & 1 deletion src/data/help_color.txt
Expand Up @@ -5,6 +5,6 @@ Infos about them can be found here: https://en.wikipedia.org/wiki/ANSI_escape_co
Examples:
--color 35: sets the color to magenta. `--color magenta` is also supported
--color 38;5;38: sets the color to 38th color of ANSI 256 colors
--color 4;92: sets the color to bright Green with underline
--color 4;92: sets the color to bright Green with underline. `--color underline_green` is also supported
--color 5;104: blinking text on a blue background
If no color is set, the main color of the logo will be used.

0 comments on commit 3d4077c

Please sign in to comment.