source: libcaca/trunk/NOTES @ 226

Last change on this file since 226 was 226, checked in by Sam Hocevar, 17 years ago
  • NOTES: + Added setab/setaf quotes from the XTerm terminfo. + Proposed a workaround for bright colours on any terminal.
  • src/caca.c: + 16 colour support for ncurses and conio.
  • src/graphics.c: + Ported to 16 colour support. + Added a missing <stdio.h> for BUFSIZ. + Disabled vsnprintf under DOS (only vsprintf exists).
  • examples/: + Don't abort if the caca.txt sprite was not found. + Ported to 16 colour support.
  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1$Id: NOTES 226 2003-11-27 21:56:30Z 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      From termcap(5):
8
9       set_a_background              setab        AB        Set background
10                                                            color to #1, using
11                                                            ANSI escape
12       set_a_foreground              setaf        AF        Set foreground
13                                                            color to #1, using
14                                                            ANSI escape
15      From the xterm terminfo:
16
17        setab=\E[4%p1%dm, setaf=\E[3%p1%dm
18
19      From the xterm-16color terminfo:
20
21        setab=\E[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm,
22        setaf=\E[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm,
23
24      (http://www.sct.gu.edu.au/~anthony/info/X/Xterm_xf86.terminfo)
25
26   o  I tested the following terminals:
27
28         name             $TERM        $COLORTERM
29        ------------------------------------------
30         Linux console    linux
31         pterm            xterm
32         aterm            xterm        rxvt-xpm
33         wterm            xterm        wterm-xpm
34         Eterm            xterm        Eterm
35         xterm            xterm
36         gnome-terminal   xterm
37         konsole          xterm
38         mlterm           mlterm
39         uxterm           xterm
40
41   o  In most terminals, \e[3xm and \[4xm respectively set the foreground
42      and background colours. x is a colour between 0 and 7 or the value
43      9 for default colour (may be transparent).
44
45      \e[0m sets everything to normal, \e[1m sets bold, \e[5m sets blink
46      and \e[7m sets inverse video.
47
48      In ncurses, only 64 colour pairs are created, and A_BOLD (\e[1m) and
49      A_BLINK (\e[5m) are used for foreground/background colour highlighting,
50      hence creating 256 possible colour pairs.
51
52      Different tests of blue on yellow:
53
54      for invert in '' '\e[7m'; do
55        for blink in '' '\e[5m'; do
56          for bold in '' '\e[1m'; do
57            echo -ne "$bold$blink$invert"'\e[33m\e[44m'hop'\e[0m '
58            echo "($bold$blink$invert)"
59          done
60        done
61      done
62
63      Successfully works on:
64       + Linux console
65       + pterm
66       + Eterm
67       + aterm, wterm, rxvt
68
69      Almost works on:
70       + xterm (bright bg only works when fg is bright and then inverted,
71         but then fg is not bright)
72
73      Fails on:
74       + mlterm (no bright colours, neither fg nor bg)
75       + gnome-terminal (no bright bg)
76       + konsole (no bright bg, $blink really blinks)
77
78   o  In an XTerm-compatible terminal, \e[9xm sets bright foreground and
79      \e[10xm bright background colours. Unfortunately all terminals don't
80      support these escape sequences. Here is a testcase:
81
82      for fgpre in 3 9; do for fg in 0 4 2 6 1 5 3 7; do
83        for bgpre in 4 10; do
84          echo -ne '\e['$fgpre$fg'm'
85          for bg in 0 4 2 6 1 5 3 7; do echo -ne '\e['$bgpre$bg'm# '; done
86          echo -ne '\e[0m '
87        done
88        echo ''
89      done; echo ''; done
90
91      Successfully tested on:
92       + gnome-terminal
93       + konsole
94       + xterm
95       + pterm
96
97      Failed (\e[9x and \e[10x don't do anything) on:
98       + Eterm
99       + aterm, wterm, rxvt
100       + mlterm
101       + Linux console
102
103   o  How to draw bright colours on any terminal?
104
105      '\e[93;104m' -> bright yellow on bright blue
106       doesn't work on mlterm, gnome-terminal, konsole
107
108      '\e[5;1;33;44m' -> bright yellow on bright blue
109       doesn't work on mlterm, aterm/wterm/rxvt, Eterm, console
110
111      '\e[5;1;33;44;93;104m' -> bright yellow on bright blue
112       works on gnome-terminal, xterm, pterm, aterm/wterm/rxvt, console
113       doesn't work on konsole
114
115   o  S-Lang:
116
117   o  MS-DOS: all bright colours, bright backgrounds, and bright combinations
118      work using <conio.h>. No need to kludge anything.
119
Note: See TracBrowser for help on using the repository browser.