Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: Terminal underline styles and colors #158827

Closed
2 tasks done
Tyriar opened this issue Aug 22, 2022 · 2 comments
Closed
2 tasks done

Test: Terminal underline styles and colors #158827

Tyriar opened this issue Aug 22, 2022 · 2 comments

Comments

@Tyriar
Copy link
Member

Tyriar commented Aug 22, 2022

Refs: #156983

Complexity: 3

Authors: @meganrogge @Tyriar

Create Issue


The terminal now supports escape sequences for different styles of underline as well as full color support. Here are some docs on the feature https://sw.kovidgoyal.net/kitty/underlines/. In addition to this, when GPU acceleration is using the webgl renderer (on/auto), we do improved underlining by not overlapping with the glyphs:

image

Basic usage (echo -e "<string>"):

# Previously supported underline sequences
\x1b[4m    # straight underline
\x1b[24m   # no underline

# Underline styles
\x1b[4:0m  # no underline
\x1b[4:1m  # straight underline
\x1b[4:2m  # double underline
\x1b[4:3m  # curly underline
\x1b[4:4m  # dotted underline
\x1b[4:5m  # dashed underline

# Underline colors (a style is required)
\x1b[58:5:32m            # 256 color palette: ANSI color number 32, see https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
\x1b[58:2:0:255:128:64m  # True color: Red=255, Green=128, Blue=64
\x1b[59m                 # reset color

Ensure all of the above sequences work as expected and look good, some things to tweak while testing:

  • terminal.integrated.gpuAcceleration ("on" or "canvas", this will not work when "off" is used)
  • terminal.integrated.fontSize
  • window.zoomLevel
  • The cells look correct when selected
  • Scroll up and down

This feature does not work on Windows because of a limitation in conpty.

@TylerLeonhardt
Copy link
Member

Love it!

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Aug 23, 2022

The script I used to test this:

# Previously supported underline sequences
$straight1 = "`e[4m"    # straight underline
$none1 = "`e[24m"   # no underline

# Underline styles
$none2 = "`e[4:0m"  # no underline
$straight2 = "`e[4:1m"  # straight underline
$double = "`e[4:2m"  # double underline
$curly = "`e[4:3m"  # curly underline
$dotted = "`e[4:4m"  # dotted underline
$dashed = "`e[4:5m"  # dashed underline

# Underline colors (a style is required)
$color1 = "`e[58:5:32m"            # 256 color palette: ANSI color number 32, see https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
$color2 = "`e[58:2:0:255:128:64m"  # True color: Red=255, Green=128, Blue=64
$noColor = "`e[59m"                 # reset color

function emit($text) {
    # Change this to a different color or different none
    "$color2$text$none2$noColor"
}

$allTheText = "abcdefghijklmnopqrstuvwxyz1234567890-=`~!@#$%^&*()_+[]\{}|;':`"/? 👽 現代"
emit ($straight1 + $allTheText)
emit ($straight2 + $allTheText)
emit ($double + $allTheText)
emit ($curly + $allTheText)
emit ($dotted + $allTheText)
emit ($dashed + $allTheText)

@github-actions github-actions bot locked and limited conversation to collaborators Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants