ANSI text decorations sequences

Underline

Style and color options have been added to the classic underline code sequences. It was originally added by Kitty, now also adopted by other terminals, and supported by applications such as vim.

See https://sw.kovidgoyal.net/kitty/underlines/

4 (underline) and 24 (no underline) are classic codes for underlines.

21 is double-underline per ECMA-48, but instead disables bold intensity on some terminals, including in the Linux kernel's console before version 4.17.

4:x are the new extensions.

n Description Example Rendered
4 straight underline "\x1B[4mHello World"
Hello World
4:0 no underline "\x1B[4mHello \x1B[4:0mWorld"
Hello World
4:1 straight underline "\x1B[4:1mHello World"
Hello World
4:2 double underline "\x1B[4:2mHello World"
Hello World
4:3 curly underline "\x1B[4:3mHello World"
Hello World
4:4 dotted underline "\x1B[4:4mHello World"
Hello World
4:5 dashed underline "\x1B[4:5mHello World"
Hello World
21 double underline "\x1B[21mHello World"
Hello World
24 no underline "\x1B[4mHello \x1B[24mWorld"
Hello World

For underline color, see the colors sequences.