urxvt
2.6 in 2004 added support for xterm's dynamic colors feature. In XTerm Control Sequences, this is OSC
11. OSC
10 sets the default text color. The changelog mentioned part of the change:
2.6 Fri Apr 2 03:24:10 CEST 2004
- minor doc corrections.
- WARNING: changed menu sequence from ESC ] 10 to ESC ] 703 to
avoid clashes with xterm.
- changed OSC701/OSC702 sequence to return standard escaped reports.
- xterm-compat: make set window colour and other requests report
window colour when arg is "?".
but the source-code tells the story, as usual:
/*
* XTerm escape sequences: ESC ] Ps;Pt (ST|BEL)
* 0 = change iconName/title
* 1 = change iconName
* 2 = change title
* 4 = change color
+ * 10 = change fg color
+ * 11 = change bg color
* 12 = change text color
* 13 = change mouse foreground color
* 17 = change highlight character colour
@@ -2949,20 +3236,21 @@
* 50 = change font
*
* rxvt extensions:
- * 10 = menu (may change in future)
* 20 = bg pixmap
* 39 = change default fg color
* 49 = change default bg color
* 55 = dump scrollback buffer and all of screen
* 701 = change locale
* 702 = find font
+ * 703 = menu
*/
The manual rxvt(7)
gives no useful information:
XTerm Operating System Commands
"ESC ] Ps;Pt ST"
Set XTerm Parameters. 8-bit ST: 0x9c, 7-bit ST sequence: ESC \
(0x1b, 0x5c), backwards compatible terminator BEL (0x07) is also
accepted. any octet can be escaped by prefixing it with SYN (0x16,
^V).
This simple example sets both foreground (text) and background default colors:
#!/bin/sh
printf '\033]10;red\007'
printf '\033]11;green\007'
Like xterm
, these default colors can be overridden temporarily by "ANSI" colors.
The feature can be disabled in xterm
using the dynamicColors
resource. Unlike xterm
, urxvt
has no resource-setting for the feature.
VTE also implements the feature, and likewise doesn't document it. urxvt
at least started with documentation from rxvt
. For VTE, you have to read the source code. The relevant feature in vteseq.cc
looks like this:
/* Change the default background cursor, BEL terminated */
static void
vte_sequence_handler_change_background_color_bel (VteTerminalPrivate *that, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (that, params,
VTE_DEFAULT_BG, -1, 11, BEL);
}
/* Change the default background cursor, ST terminated */
static void
vte_sequence_handler_change_background_color_st (VteTerminalPrivate *that, GValueArray *params)
{
vte_sequence_handler_change_special_color_internal (that, params,
VTE_DEFAULT_BG, -1, 11, ST);
}
That code dates back to sometime in 2003 (when it was written in C):
commit f39e281529827f68fd0e9bba41785d66a21efc1c
Author: Nalin Dahyabhai <nalin@src.gnome.org>
Date: Wed Jan 22 21:35:22 2003 +0000
accept OSC{number};{string}ST as set-text-parameters, per XTerm docs (part
* src/caps.c: accept OSC{number};{string}ST as set-text-parameters, per XTerm
docs (part of #104154).
* src/keymap.c: revert change to prepend "1;" to keys with modifiers (#104139).
Further reading:
Best Answer
Use the
-pixmap
option to set the background image for RXVT. For instance, I have a set of small.png
tiles that I pick at random using the following one-liner:You could easily turn the above into an alias or script.