OSC 19 — Set highlight (selection) foreground colour
Change the foreground colour the terminal uses for selected (highlighted) text.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b]19;#RRGGBB\x07 (set) \x1b]19;?\x07 (query)\033]19;#RRGGBB\007\e]19;#RRGGBB\aESC ] 19 ; COLOR BEL1b 5d 31 39 3b ... 07Description
OSC 19 sets the foreground colour used for selected (mouse-highlighted) text — the glyph colour you see on top of the OSC 17 highlight band. Colour syntax matches OSC 10 / 11 / 12 / 17: `#RRGGBB`, `#RGB`, `rgb:RRRR/GGGG/BBBB`, X11 names. Sending `?` queries the current value (the terminal replies with `\x1b]19;rgb:...\x07`). Like OSC 17 this is historically xterm-specific and most modern terminals route selection colours through their theme config rather than runtime OSC; check the support matrix before relying on it. Use the matching reset `\x1b]119\x07` to restore the user's configured highlight fg.
Spec citation: xterm-ctlseqs (OSC 19 / 119)
Examples
printf '\033]19;#cdd6f4\007' # set selection fg\nprintf '\033]19;?\007' # queryimport sys; sys.stdout.write('\x1b]19;#cdd6f4\x07')fmt.Print("\x1b]19;#cdd6f4\x07")process.stdout.write('\x1b]19;#cdd6f4\x07')printf("\x1b]19;#cdd6f4\x07");Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- no
- iTerm2
- no
- Windows Terminal
- no
- cmd.exe / ConPTY
- no
- kitty
- no
- alacritty
- no
- WezTerm
- partial
- Ghostty
- no
- GNOME Terminal
- partial
- Konsole
- partial
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | no | no | no | no | no | no | no | partial | no | partial | partial | no | no |