File: NOTES

package info (click to toggle)
libcaca 0.99.beta19-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 7,312 kB
  • sloc: ansic: 22,346; python: 2,316; cs: 1,213; cpp: 1,114; java: 916; objc: 836; makefile: 606; sh: 457; ruby: 193; asm: 65
file content (125 lines) | stat: -rw-r--r-- 4,429 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

   o  Colour does not work with all backends and all terminals. I tested
      many terminal emulators and tried to summarise which combinations
      worked properly and which ones did not.

      From termcap(5):

       set_a_background              setab        AB        Set background
                                                            color to #1, using
                                                            ANSI escape
       set_a_foreground              setaf        AF        Set foreground
                                                            color to #1, using
                                                            ANSI escape
      From the xterm terminfo:

        setab=\E[4%p1%dm, setaf=\E[3%p1%dm

      From the xterm-16color terminfo:
      (http://www.sct.gu.edu.au/~anthony/info/X/Xterm_xf86.terminfo)

        setab=\E[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm,
        setaf=\E[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm,

      These values can be simply retrieved with a tigetstr() call.

   o  I tested the following terminals:

         name             $TERM        $COLORTERM
        ------------------------------------------
         Linux console    linux
         pterm            xterm
         aterm            xterm        rxvt-xpm
         wterm            xterm        wterm-xpm
         Eterm            xterm        Eterm
         xterm            xterm
         gnome-terminal   xterm
         konsole          xterm
         mlterm           mlterm
         uxterm           xterm

   o  In most terminals, \e[3xm and \[4xm respectively set the foreground
      and background colours. x is a colour between 0 and 7 or the value
      9 for default colour (may be transparent).

      \e[0m sets everything to normal, \e[1m sets bold, \e[5m sets blink
      and \e[7m sets inverse video.

      In ncurses, only 64 colour pairs are created, and A_BOLD (\e[1m) and
      A_BLINK (\e[5m) are used for foreground/background colour highlighting,
      hence creating 256 possible colour pairs.

      Different tests of blue on yellow:

      for invert in '' '\e[7m'; do
        for blink in '' '\e[5m'; do
          for bold in '' '\e[1m'; do
            echo -ne "$bold$blink$invert"'\e[33m\e[44m'hop'\e[0m '
            echo "($bold$blink$invert)"
          done
        done
      done

      Successfully works on:
       + Linux console
       + pterm
       + Eterm
       + aterm, wterm, rxvt

      Almost works on:
       + xterm (bright bg only works when fg is bright and then inverted,
         but then fg is not bright)

      Fails on:
       + mlterm (no bright colours, neither fg nor bg)
       + gnome-terminal (no bright bg)
       + konsole (no bright bg, $blink really blinks)

   o In an XTerm-compatible terminal, \e[9xm sets bright foreground
     and \e[10xm bright background colours. Documentation on this can be
     found at http://ftp.xfree86.org/pub/XFree86/4.2.1/doc/ctlseqs.TXT .
     Unfortunately all terminals don't support these escape sequences. Here
     is a testcase:

      for fgpre in 3 9; do for fg in 0 4 2 6 1 5 3 7; do
        for bgpre in 4 10; do
          echo -ne '\e['$fgpre$fg'm'
          for bg in 0 4 2 6 1 5 3 7; do echo -ne '\e['$bgpre$bg'm# '; done
          echo -ne '\e[0m '
        done
        echo ''
      done; echo ''; done

      Successfully tested on:
       + gnome-terminal
       + konsole
       + xterm
       + pterm

      Failed (\e[9x and \e[10x don't do anything) on:
       + Eterm
       + aterm, wterm, rxvt
       + mlterm
       + Linux console

   o  How to draw bright colours on any terminal?

      '\e[93;104m' -> bright yellow on bright blue
       doesn't work on mlterm, gnome-terminal, konsole

      '\e[5;1;33;44m' -> bright yellow on bright blue
       doesn't work on mlterm, aterm/wterm/rxvt, Eterm, console

      '\e[5;1;33;44;93;104m' -> bright yellow on bright blue
       works on gnome-terminal, xterm, pterm, aterm/wterm/rxvt, console
       doesn't work on konsole

   o  MS-DOS: all bright colours, bright backgrounds, and bright combinations
      work using <conio.h>. No need to kludge anything.

   o  Win32: we use GetConsoleScreenBufferInfo etc. There is an interesting
      tutorial here: http://www.adrianxw.dk/SoftwareSite/index.html

   o  Set terminal window title:
      http://mail.gnome.org/archives/mc-devel/2003-January/msg00101.html