Hi,
I rewrote this RXVT patch to comply to Xterm's behaviour (Lacking other
sources of input). The experimental codes have been replaced with Xterm's
ones.
This Patch lets the user switch the color palette via some ESC-codes.
See ctlseqs.ms contained in ftp://dickey.his.com/xterm/xterm.tar.gz
Operating System Controls
OSC Ps ; Pt BEL (orig. ST, yes I know...)
Ps = 4 ; c ; name -> Change Color #c to cname. Any
number of c name pairs may be given. )
Rxvt's escape Sequences are explained at
http://www.rxvt.org/refer/rxvtRef.html
There is at least one fine tool for palette selection:
http://freshmeat.net/projects/palette/?highlight=palette
http://dimavb.st.simbirsk.su/vlk/
http://dimavb.st.simbirsk.su/vlk/palette-0.70.tar.gz
You need the attached tiny patch to make palette work with rxvt.
The main problem is that Rxvt won't accept ST as an end-sequence for OSC
One needs to send BEL. That is deprecated but works with both Rxvt and
Xterm.
One other tweak is to change OSC 10 and OSC 11 to OSC 39 and OSC 49.
Could someone please let me know if Rxvt's OSC 10 (menu) is important?
Or can we move it to another code and let OSC 10 and OSC 11 be aliases for
OSC 39 and OSC 49?
Any input is welcome -- I do care.
cu.
:
Christian
--- rxvt-2.7.3-pristine/README.palette Sat Sep 9 18:52:45 2000
+++ rxvt-2.7.3/README.palette Sat Sep 9 19:02:12 2000
@@ -0,0 +1,54 @@
+Color extensions of XTerm escape sequences: ESC ] Ps;Pt BEL
+(Escape Sequences are explained at http://www.rxvt.org/refer/rxvtRef.html)
+
+Note: Ps values are no longer experimental -- we simply emulate Xterm
+(see ctlseqs.ms contained in ftp://dickey.his.com/xterm/xterm.tar.gz:
+ Operating System Controls
+ OSC Ps ; Pt BEL
+ Ps = 4 ; c ; name -> Change Color #c to cname. Any
+ number of c name pairs may be given. )
+
+There are some examples. See rxvt-pal.tar.gz
+
+Author Christian W. Zuckschwerdt <[EMAIL PROTECTED]> 2000-04-27 - 2000-09-08
+
+In addition to the Ps values 39 and 49 there are some other
+values to change the actual rxvt color scheme.
+
+ESC ] Ps;Pt BEL
+
+ Ps = 3 9 Change default foreground colour to Pt
+ Ps = 4 9 Change default background colour to Pt
+
+ Ps = 4 ; c ; name Change Color #c to cname. Any
+ number of c name pairs may be given.
+ Ps = 1 2 Change color name of text cursor foreground to Pt
+ Ps = 1 3 Change color name of mouse foreground to Pt
+ Ps = 1 7 Change color name of highlight to Pt
+ Ps = 1 8 Change color name of bold characters to Pt
+ Ps = 1 9 Change color name of underlined characters to Pt
+
+please note that Ps=10 and Ps=11 should change the foreground and back-
+ground color. But RXVT already assigned another function (menu) to Ps=10!
+
+That is eg.
+
+ESC ] 4 ; 0 ; name Change former 'black' color
+ESC ] 4 ; 1 ; name Change former 'red' color
+ESC ] 4 ; 2 ; name Change former 'green' color
+ESC ] 4 ; 3 ; name Change former 'yellow' color
+ESC ] 4 ; 4 ; name Change former 'blue' color
+ESC ] 4 ; 5 ; name Change former 'magenta' color
+ESC ] 4 ; 6 ; name Change former 'cyan' color
+ESC ] 4 ; 7 ; name Change former 'white' color
+ESC ] 4 ; 8 ; name Change former 'bright black' color
+ESC ] 4 ; 9 ; name Change former 'bright red' color
+ESC ] 4 ; 10 ; name Change former 'bright green' color
+ESC ] 4 ; 11 ; name Change former 'bright yellow' color
+ESC ] 4 ; 12 ; name Change former 'bright blue' color
+ESC ] 4 ; 13 ; name Change former 'bright magenta' color
+ESC ] 4 ; 14 ; name Change former 'bright cyan' color
+ESC ] 4 ; 15 ; name Change former 'bright white' color
+
+More documentation on request, if anyone actually cares.
+
--- rxvt-2.7.3-pristine/src/command.c Fri Jan 14 06:05:03 2000
+++ rxvt-2.7.3/src/command.c Sat Sep 9 19:06:06 2000
@@ -1987,6 +1987,9 @@
{
int changed = 0;
int fd;
+ char *buf; /* belongs to color code -- move away sometime */
+ char *name; /* belongs to color code -- move away sometime */
+ int color; /* belongs to color code -- move away sometime */
assert(str != NULL);
switch (op) {
@@ -2027,6 +2030,45 @@
case XTerm_restoreBG:
set_window_color(Color_bg, str);
break;
+ case XTerm_Color:
+ /* this color code should be moved away sometime */
+ buf = str;
+ while (buf && *buf) {
+ name = strchr(buf, ';');
+ if (name == NULL)
+ break;
+ *name = '\0';
+ name++;
+ color = atoi(buf);
+ if (color < 0 || color >= TOTAL_COLORS)
+ break;
+ buf = strchr(name, ';');
+ if (buf) {
+ *buf = '\0';
+ buf++;
+ }
+ set_window_color(color+minCOLOR, name);
+ }
+ break;
+#ifndef NO_CURSORCOLOR
+ case XTerm_Color_cursor:
+ set_window_color(Color_cursor, str);
+ break;
+ case XTerm_Color_highlight:
+ set_window_color(Color_cursor2, str);
+ break;
+#endif
+ case XTerm_Color_pointer:
+ set_window_color(Color_pointer, str);
+ break;
+#ifndef NO_BOLDUNDERLINE
+ case XTerm_Color_BD:
+ set_window_color(Color_BD, str);
+ break;
+ case XTerm_Color_UL:
+ set_window_color(Color_UL, str);
+ break;
+#endif
case XTerm_logfile:
break;
case XTerm_font:
--- rxvt-2.7.3-pristine/src/main.c Sun Feb 27 05:57:52 2000
+++ rxvt-2.7.3/src/main.c Sat Sep 9 19:01:25 2000
@@ -785,7 +785,10 @@
XRecolorCursor(Xdisplay, TermWin_cursor, &fg, &bg);
}
/* the only reasonable way to enforce a clean update */
- scr_poweron();
+/* scr_poweron(); */
+/* scr_touch means our window is fully exposed */
+/* A redraw will occur, right? */
+ scr_touch(0);
}
#else
# define set_window_color(idx,color) ((void)0)
--- rxvt-2.7.3-pristine/src/rxvt.h Sun Feb 27 05:57:52 2000
+++ rxvt-2.7.3/src/rxvt.h Sat Sep 9 19:03:00 2000
@@ -475,6 +475,18 @@
#define restoreFG 39 /* restore default fg color */
#define restoreBG 49 /* restore default bg color */
+/*
+ * color extensions of XTerm escape sequences: ESC ] Ps;Pt BEL
+ * Ps values are no longer experimental -- we emulate Xterm
+ * Christian W. Zuckschwerdt <[EMAIL PROTECTED]> 2000-04-27 - 2000-09-08
+ */
+#define XTerm_Color 4 /* change colors */
+#define XTerm_Color_cursor 12 /* change actual 'Cursor' color */
+#define XTerm_Color_pointer 13 /* change actual 'Pointer' color */
+#define XTerm_Color_highlight 17 /* change actual 'Highlight' color */
+#define XTerm_Color_BD 18 /* change actual 'Bold' color */
+#define XTerm_Color_UL 19 /* change actual 'Underline' color */
+
/* Words starting with `Color_' are colours. Others are counts */
enum colour_list {
--- palette-0.70/src/term.c.orig Sun Aug 6 06:43:25 2000
+++ palette-0.70/src/term.c Sat Sep 9 19:14:38 2000
@@ -45,13 +45,13 @@
fprintf (stdout, "\e]P%01x%02x%02x%02x", palette_number, r, g, b);
break;
case TERM_XTERM :
- fprintf(stdout, "\e]4;%d;#%2.2x%2.2x%2.2x\e\\",palette_number, r, g, b);
+ fprintf(stdout, "\e]4;%d;#%2.2x%2.2x%2.2x\a",palette_number, r, g, b);
if (palette_number == 0)
/* If setting 'black', also set the background */
- fprintf(stdout, "\e]11;#%02x%02x%02x\e\\", r, g, b);
+ fprintf(stdout, "\e]49;#%02x%02x%02x\a", r, g, b);
else if (palette_number == 7)
/* if setting 'white', also set the foreground */
- fprintf(stdout, "\e]10;#%02x%02x%02x\e\\", r, g, b);
+ fprintf(stdout, "\e]39;#%02x%02x%02x\a", r, g, b);
break;
}
fflush(stdout);