vercel / hyper

A terminal built on web technologies

Home Page:https://hyper.is

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for color changing escape sequences

dylanaraps opened this issue · comments

commented
  • I am on the latest Hyper.app version
  • I have searched the issues of this repo and believe that this is not a duplicate
  • OS version and name: Arch Linux
  • Hyper.app version: 1.3.3
  • Link of a Gist with the contents of your .hyper.js: No changes made to default config. (N/A)
  • Relevant information from devtools: N/A
  • The issue is reproducible in vanilla Hyper.app: Yes

Issue

These escape sequences manipulate the open terminal's colorscheme and allow you to change your terminal's colorscheme on the fly. These escape sequences are supported by all of the terminal emulators I've tried with the exception of konsole which ignores them.

Two of my projects use these escape sequences for their main purpose and they currently don't work in Alacritty since the sequences aren't yet supported.

I fully understand if you don't want to implement this feature, there are a lot of really weird escape sequences in the Xterm/Rxvt specs and I understand that you want to keep Hyper simple. ^^

The sequences are as follows:

# Manipulate colors 0-256
# \033]4;{index};{color}\007

# Change color 7 to #FFFFFF
\033]4;7;#FFFFFF\007

# Change color 14 to #333333
\033]4;14;#333333\007

# Manipulate special colors.
# 10 = foreground, 11 = background, 12 = cursor foregound
# 13 = mouse foreground, 708 = terminal border background
# \033]{index};{color}\007

# Change the terminal foreground to #FFFFFF
\033]10;#FFFFFF\007

# Change the terminal background to #000000
\033]11;#000000\007

# Change the terminal cursor to #FFFFFF
\033]12;#FFFFFF\007

# Change the terminal border background to #000000
\033]708;#000000\007

Source:

More information:

Hey there, to verify if this is indeed a Hyper issue or upstream at https://github.com/xtermjs/xterm.js/ could you please test if another xterm.js powered terminal shows the same problem you are experiencing? I suggest using https://github.com/Microsoft/vscode for testing. Thanks!

@Stanzilla I have verified that this works in VS Code:

Terminal Colors - VS Code

VS Code version info:

Version 1.22.2
Commit 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9
Date 2018-04-12T16:38:45.278Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

However, the colors are displayed as escape characters in Hyper:

Terminal Colors - Hyper

Here's my about screen:

Hyper - About

I have tried this with and without the zenburn plugin.

Thanks!

PS - in case this wasn't obvious from the screenshots, I am on Windows 10 ... I don't have an arch box handy to try to repro this from the original report :(

This problem does not appear on OSX.

image

commented

I’ll test this on Arch in an hour or so.

commented

The sequences do not work in vscode.

Yeah, actually today they are not working for me in VS Code either...I am not sure what changed in the meantime. I am using the same version.

Try echo -e '\e[31m 767M \e[41m____________________\e[m \e[31mdir1/\e[m'
It works for me in putty, VS Code etc.
image
but this does not work on Hyper:
image
although, if I don't set foreground color, it works:
image

Using Hyper 2.0.0 on WSL
image

Wondering about the status of this issue. Is there a current fix for changing the colorscheme via wal/pywal?

I got around this issue on Windows 10 adding a value in the registry. Add a REG_DWORD type variable called VirtualTerminalLevel with an hexadecimal value of 1 at Computer\HKEY_CURRENT_USER\Console and restart hyper. It should recognize color escape sequences correctly then.

Tested echo -e '\e[31m 767M \e[41m____________________\e[m \e[31mdir1/\e[m'
on mac, windows & ubuntu using the latest canary build
Screenshot 2020-07-04 at 11 06 49
It seems to be working well
Feel free to open a new issue if you face any other problems

commented

@LabhanshAgrawal Those aren't the sequences I am talking about. Please reopen this issue and please carefully read my initial post.

I had closed this based on earlier comment by vivek
@dylanaraps can you give any command to test it
I get this when I run the command from pywal wiki
Screenshot 2021-02-08 at 12 26 50
nothing is printed or changed in the rest of the terminal for me
is this ok?

This is a command to test it. When running this on e.G. xterm, the color scheme will change to solarized dark.

(As always take a look at it before pasting into the terminal)

printf '\x1b]12;#dc302f\x07\x1b]11;#002b36\x07\x1b]10;#839496\x07\x1b]708;#002b36\x07\x1b]4;0;#073642\x07\x1b]4;1;#dc302f\x07\x1b]4;2;#859900\x07\x1b]4;3;#b58900\x07\x1b]4;4;#268bd2\x07\x1b]4;5;#d33681\x07\x1b]4;6;#29a198\x07\x1b]4;7;#eee8d5\x07\x1b]4;9;#cb4b16\x07\x1b]4;8;#002b36\x07\x1b]4;10;#586d75\x07\x1b]4;11;#657b83\x07\x1b]4;12;#839496\x07\x1b]4;13;#6c71c4\x07\x1b]4;14;#93a1a1\x07\x1b]4;15;#fdf6e3\x07'

I'm confirming that this works well on Windows 11 with Hyper 3.1.5.

image

Closing as fixed (added in xterm 4.16)