termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
37.01k stars 3.89k forks source link

Support styled underlines #870

Open mklein994 opened 6 years ago

mklein994 commented 6 years ago

It would be great if support could be added for styled underlines.

Here's a brief overview:

Note: the colon is strictly required, as something like \e[4;1mHello\e[0m would print a bold, underlined "Hello" to the console. This is discussed in the neovim issue.

Support for this was added to neovim in https://github.com/neovim/neovim/issues/7479, and in tmux (so far without color support) in https://github.com/tmux/tmux/issues/1492. There's an idea floating around that the underline can be given a color using 58:2:<r>:<g>:<b> or 58:5:<x11 color>, similar to how it's done for true colors. From what I've read, CSI 59 resets the underline color. (I'm not a terminal developer, so please forgive me if I'm butchering these terms).

Here's an example:

echo -e '\e[4:3;58:2:255:100:0mHello\e[0m'

undercurl This produces "Hello", with an orange wavy underline. I've tested it and it works on both mintty and kitty.

oblitum commented 1 year ago

I badly wanted this. Notice that since this issue was opened a good amount of underline styling variations now exist, NeoVim/Tmux/Alacritty all support having (from NeoVim docs):

1. TUI highlight arguments

                    *bold* *underline* *undercurl*
                    *underdouble* *underdotted*
                    *underdashed* *inverse* *italic*
                    *standout* *nocombine* *strikethrough*
cterm={attr-list}           *attr-list* *highlight-cterm* *E418*
    attr-list is a comma-separated list (without spaces) of the
    following items (in any order):
        bold
        underline
        undercurl   curly underline
        underdouble double underline
        underdotted dotted underline
        underdashed dashed underline
        strikethrough
        reverse
        inverse     same as reverse
        italic
        standout
        nocombine   override attributes instead of combining them
        NONE        no attributes used (used to reset it)

    Note that "bold" can be used here and by using a bold font.  They
    have the same effect.
    "undercurl", "underdouble", "underdotted", and "underdashed" fall back
    to "underline" in a terminal that does not support them. The color is
    set using |guisp|.
oblitum commented 1 year ago

Good to mention that we also have colored underlines established these days, not a floating idea anymore. I use both features, styled & colored underlines, in my standard setup, which I have to disable when over termux.