1 | $Id: NOTES 225 2003-11-27 13:27:32Z sam $ |
---|
2 | |
---|
3 | o Colour does not work with all backends and all terminals. I tested |
---|
4 | many terminal emulators and tried to summarise which combinations |
---|
5 | worked properly and which ones did not. |
---|
6 | |
---|
7 | o I tested the following terminals: |
---|
8 | |
---|
9 | name $TERM $COLORTERM |
---|
10 | ------------------------------------------ |
---|
11 | Linux console linux |
---|
12 | pterm xterm |
---|
13 | aterm xterm rxvt-xpm |
---|
14 | wterm xterm wterm-xpm |
---|
15 | Eterm xterm Eterm |
---|
16 | xterm xterm |
---|
17 | gnome-terminal xterm |
---|
18 | konsole xterm |
---|
19 | mlterm mlterm |
---|
20 | uxterm xterm |
---|
21 | |
---|
22 | o In most terminals, \e[3xm and \[4xm respectively set the foreground |
---|
23 | and background colours. x is an colour between 0 and 7 or the value |
---|
24 | 9 for default value. |
---|
25 | |
---|
26 | \e[0m sets everything to normal, \e[1m sets bold, \e[5m sets blink |
---|
27 | and \e[7m sets inverse video. |
---|
28 | |
---|
29 | In ncurses, only 64 colour pairs are created, and A_BOLD (\e[1m) and |
---|
30 | A_BLINK (\e[5m) are used for foreground/background colour highlighting, |
---|
31 | hence creating 256 possible colour pairs. |
---|
32 | |
---|
33 | Different tests of blue on yellow: |
---|
34 | |
---|
35 | for invert in '' '\e[7m'; do |
---|
36 | for blink in '' '\e[5m'; do |
---|
37 | for bold in '' '\e[1m'; do |
---|
38 | echo -ne "$bold$blink$invert"'\e[34m\e[43m'hop'\e[0m ' |
---|
39 | echo "($bold$blink$invert)" |
---|
40 | done |
---|
41 | done |
---|
42 | done |
---|
43 | |
---|
44 | Successfully works on: |
---|
45 | + Linux console |
---|
46 | + pterm |
---|
47 | + Eterm |
---|
48 | + aterm, wterm, rxvt |
---|
49 | |
---|
50 | Almost works on: |
---|
51 | + xterm (bright bg works for blue, but not for red or yellow) |
---|
52 | |
---|
53 | Fails on: |
---|
54 | + mlterm (no bright colours, neither fg nor bg) |
---|
55 | + gnome-terminal (no bright bg) |
---|
56 | + konsole (no bright bg, $blink really blinks) |
---|
57 | |
---|
58 | o In an XTerm-compatible terminal, \e[9xm sets bright foreground and |
---|
59 | \e[10xm bright background colours. Unfortunately all terminals don't |
---|
60 | support these escape sequences. Here is a testcase: |
---|
61 | |
---|
62 | for fgpre in 3 9; do for fg in 0 4 2 6 1 5 3 7; do |
---|
63 | for bgpre in 4 10; do |
---|
64 | echo -ne '\e['$fgpre$fg'm' |
---|
65 | for bg in 0 4 2 6 1 5 3 7; do echo -ne '\e['$bgpre$bg'm# '; done |
---|
66 | echo -ne '\e[0m ' |
---|
67 | done |
---|
68 | echo '' |
---|
69 | done; echo ''; done |
---|
70 | |
---|
71 | Successfully tested on: |
---|
72 | + gnome-terminal |
---|
73 | + konsole |
---|
74 | + xterm |
---|
75 | + pterm |
---|
76 | |
---|
77 | Failed (\e[9x and \e[10x don't work) on: |
---|
78 | + Eterm |
---|
79 | + aterm, wterm, rxvt |
---|
80 | + mlterm |
---|
81 | + linux |
---|
82 | |
---|
83 | o S-Lang: |
---|
84 | |
---|
85 | o MS-DOS: all bright colours, bright backgrounds, and bright combinations |
---|
86 | work using <conio.h>. No need to kludge anything. |
---|
87 | |
---|