Skip to content

Add support for 256-color palette altering via code: \e]4;n;#rrggbb\a

Thanks for filing an issue! Please answer the questions below so I can help you.

  • iTerm2 version: 3.2.1beta2
  • OS version: 10.13.4 (17E202)
  • Attach ~/Library/Preferences/com.googlecode.iterm2.plist here (drag-drop from finder into this window)

Detailed steps to reproduce the problem:

  1. Execute in bash/zsh/etc.: echo -ne '\e]4;2;#aa00aa\a', it should change color 2 into a magenta one
  2. Execute in bash/zsh/etc.: echo -e '\e[32m'Test text'\e[0m', it should use color 2 and output a test text in magenta, not green
  3. I've noticed that echo -en ... doesn't work well on OS X Bash 3.2, Homebrew bash 4.4 works fine.

What happened: String "Test text" was printed in green

What should have happened: String "Test text" printed in magenta 0xaa00aa

Overall, this control sequence works in xterm, gnome-terminal and urxvt. It seems that OS X terminals are lagging behind, I've tested Terminal.app, iTerm and ExtraTerm and found no support for the \e]4;n;#rrggbb\a sequence. Only \e]P2aa00aa is supported, but it allows to alter only first 16 colors in the palette (the number after char P can be only 0..f).

Can be the main OS X terminal app (i.e. iTerm2) uplifted to support this de-facto standard sequence: \e]4;n;#rrggbb\a?

com.googlecode.iterm2.plist

This is to be used with Zshell, which doesn't support 24-bit color and its plugin zdharma/fast-syntax-highlighting. Basically, the colors needed by syntax-highlighting (see e.g. asciinema/203654) of the command-line would become possible to set 100% faithfully.

Edited by Ghost User