feat(color): add prev_fg and prev_bg as color specifiers based on the previous foreground/background colors respectively (#6017)

feat(color): add prevfg,prevbg as color specifiers based on the previous foreground/background colors respectively

Co-authored-by: Vladimir Lushnikov <vladimir@solidninja.is>
This commit is contained in:
Jovan Gerodetti
2024-06-28 23:40:35 +02:00
committed by GitHub
parent e0281868c9
commit 9a3e87f2cb
5 changed files with 250 additions and 94 deletions
+3 -1
View File
@@ -358,7 +358,9 @@ Style strings are a list of words, separated by whitespace. The words are not ca
- `<color>`
- `none`
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future.
`<color>` can also be set to `prev_fg` or `prev_bg` which evaluates to the previous item's foreground or background color respectively if available or `none` otherwise.
`inverted` swaps the background and foreground colors. The order of words in the string does not matter.
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.