Colored underlines in set_color and fish_color_*

Add a new underline-color option to set_color (instead of adding an optional
color argument to --underline); this allows to set the underline color
independently of underline style (line, curly, etc.). I don't think this
flexibility is very important but this approach is probably the least hacky.

Note that there are two variants:
1. \e[58:5:1m
2. \e[58;5;1m

Variant 1 breaks:
breakage from colon-variant for colored underlines
- cool-retro-term makes text blink
- GNU screen (goes into bold mode)
- terminology (goes into bold mode)

Variant 2 would break:
- mintty (Cygwin terminal) -- it enables bold font instead.
- Windows Terminal (where it paints the foreground yellow)
- JetBrains terminals echo the colons instead of consuming them
- putty
- GNU screen (goes into bold mode)
- st
- urxvt
- xterm
- etc.

So choose variant 1.

Closes #11388
Closes #7619
This commit is contained in:
Johannes Altmanninger
2025-04-14 15:36:50 +02:00
parent cc9849c279
commit ce631fd2fb
12 changed files with 196 additions and 83 deletions

View File

@@ -37,6 +37,9 @@ The following options are available:
**-b** or **--background** *COLOR*
Sets the background color.
**--underline-color** *COLOR*
Set the underline color.
**-c** or **--print-colors**
Prints the given colors or a colored list of the 16 named colors.

View File

@@ -90,12 +90,15 @@ Syntax highlighting variables
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The colors used by fish for syntax highlighting can be configured by changing the values of various variables. The value of these variables can be one of the colors accepted by the :doc:`set_color <cmds/set_color>` command.
The modifier switches accepted by ``set_color`` like
Options accepted by ``set_color`` like
``--background=``,
``--bold``,
``--dim``,
``--italics``,
``--reverse`` and
``--underline`` are also accepted.
``--reverse``,
``--underline`` and
``--underline-color=``
are also accepted.
Example: to make errors highlighted and red, use::

View File

@@ -144,6 +144,10 @@ Optional Commands
- setab
- Select background color Ps from the 256-color-palette.
-
* - ``\e[58:5: Ps m`` (note: colons not semicolons)
- Su
- Select underline color Ps from the 256-color-palette.
- kitty
* - ``\e[ Ps m``
- setaf
setab
@@ -161,6 +165,14 @@ Optional Commands
-
- Select background color from 24-bit RGB colors.
-
* - ``\e[58:2:: Ps : Ps : Ps m`` (note: colons not semicolons)
- Su
- Select underline color from 24-bit RGB colors.
- kitty
* - ``\e[59m``
- Su
- Reset underline color (follow foreground color).
- kitty
* - ``\e[ Ps S``
- indn
- Scroll forward Ps lines.