-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add support for setting colors using "Operation System Command" sequence. #1493
Comments
This would have to be supported by node-pty? If the command is in a script that is ran by the server, |
This will be possible by hooking a handler in here https://github.com/xtermjs/xterm.js/blob/master/src/InputHandler.ts#L211 @inoyatov Do you some typical examples for this OSC command? I find the description in the xterm docs kinda hard to grasp. @pro-src node-pty will simply forward to xterm.js, it does not matter if the bytes were created by printf or any other means. |
Is this defined in http://invisible-island.net/xterm/ctlseqs/ctlseqs.html? That's typically the spec we work from. |
@Tyriar it is defined under Operation System Commands in source you specified. |
@Tyriar If I get it right this seems to change a color in the palette permanently? |
@jerch not permanently it will last until terminal session ends. Which means if you reload xterm colors will reset to original. |
Yeah, we will want to override the terminal's |
Some notes:
|
Dose anyone knew how to make "Device Control String" (DCS) request in terminal? I read this but cannot figure out and google also not helpfull:
If I understood correctly, it allows request termcap color request. So, we can make request for each color. Please, help me to understand how this works. I will try to contribute as well. (Can somebody provide for dummies reference to read in order to understand 😄) |
@inoyatov For DCS examples you can have a look at |
Any update on this? Would be great to have to make a base16-shell config work in VSCode. They use that escape sequence to reset the ANSI colors and a few more. |
@maxekman Nope not yet. We recently changed the way attributes are stored internally and are still in the middle of of repo/codebase refactoring, thus feature enhancements like this have to wait until we are settled with the new and easier to use lib infrastructure. |
Sound good, thanks for the update! |
Later on I expect ColorManager will become IColorService and we could have a component that depends on ICoreService and IColorService to hook up the OSC handler and update the colors. Probably a good idea to wait as @jerch suggests. |
For information, I've been working on #3163 that, once finished and if merged, would provide support to set colors using OSC 4 sequences. |
This was done in #3524 |
In traditional terminals which support 256 color, (Gnome terminal, xterm, iTerm and etc.) colors can be set using Operation System Command sequence. In example:
printf "\033]4;18;rgb:ff/00/00\033\\"
. Where\033
escape character and 4 means color set command, followed by color number 18 and color in RGB with closing `\033\' escape sequence. However, terminals which built using xterm.js (VC's internal terminal or Hyper terminal) dose not reflect system color change commands.Details
Steps to reproduce
printf "\033]4;18;rgb:ff/00/00\033\\"
in Gnome terminal and Hyper or VC's terminal for comparison.printf "\033[38;5;18mWhat color is it?\033[0m\n"
. It shows "What color is it?" in RED color on the gnome terminal however on Hyper terminal it shows blue (Images attached). Changes by previous command was not reflected to xterm.js.So, it would be nice if it will be added to xterm.js since there is many color themes which require custom colors.
Gnome output:
Hyper output:
The text was updated successfully, but these errors were encountered: