Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / groff / contrib / hdtbl / examples / rainbow.roff
1 .\" -*- mode: roff -*-
2 .ig
3
4 rainbow.roff
5
6 This file is part of groff, the GNU roff type-setting system.
7
8 Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
9 written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
10
11 groff is free software; you can redistribute it and/or modify it under
12 the terms of the GNU General Public License as published by the Free
13 Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 groff is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program. If not, see <http://www.gnu.org/licenses/>.
23
24 ..
25 .
26 .time start
27 .
28 .nr *n 25
29 .nr *# 0 1
30 .
31 .de ctab
32 .  nr #cc 0
33 .  PN \\$1 \
34      ".nr #cc +(1f / \\$1)" \
35      ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \
36      ".TBL csp=\n[l]/(12*\\$1+2) border= cpd=0 bgc=\\\\n[t*#] bc=" \
37        ".if (\\\\n+[*#] == 1) \
38           .CPTN Rainbow Colors \[em] Nested Tables with Colored Backgrounds \
39                 val=b" \
40        .TR \
41          .TD
42 ..
43 .
44 .ctab \n[*n] 1            0           \En[#cc]u      \" rot     -> magenta
45 .ctab \n[*n] 1-\En[#cc]u  0           1              \" magenta -> blue
46 .ctab \n[*n] 0            \En[#cc]u   1              \" blue    -> cyan
47 .ctab \n[*n] 0            1           1-\En[#cc]u    \" cyan    -> green
48 .ctab \n[*n] \En[#cc]u    1           0              \" green   -> yellow
49 .ctab \n[*n] 1            1-\En[#cc]u 0              \" yellow  -> red
50 .
51 .PN 6*\n[*n] .ETB
52 .
53 .time end
54 .
55 .bp
56 .
57 .time start
58 .
59 .nr *n 25
60 .nr *# 0 1
61 .
62 .de ctab
63 .  nr #cc 0
64 .  PN \\$1 \
65      ".nr #cc +(1f / \\$1)" \
66      ".defcolor \En[t*#] rgb \\$2 \\$3 \\$4" \
67      ".TBL border=\n[l]/(12*\\$1+2) csp=0 cpd=0 bc=\\\\n[t*#] bgc=" \
68        ".if (\\\\n+[*#] == 1) \
69           .CPTN Rainbow Colors \[em] Nested Tables with Colored Borders \
70                 val=b" \
71        .TR \
72          .TD
73 ..
74 .
75 .ctab \n[*n] 1            \En[#cc]u   0               \" red     -> yellow
76 .ctab \n[*n] 1-\En[#cc]u  1           0               \" yellow  -> green
77 .ctab \n[*n] 0            1           \En[#cc]u       \" green   -> cyan
78 .ctab \n[*n] 0            1-\En[#cc]u 1               \" cyan    -> blue
79 .ctab \n[*n] \En[#cc]u    0           1               \" blue    -> magenta
80 .ctab \n[*n] 1            0           1-\En[#cc]u     \" magenta -> red
81 .
82 .PN 6*\n[*n] .ETB
83 .
84 .time end
85 .
86 .\"     466MHz Celeron CPU, 384MB RAM 
87 .\"     WindowsXP/cygwin groff18.1:     11/10s
88 .\"     WindowsXP/cygwin groff19.2:     57/55s
89 .\"     Suse Linux 9.3 groff19.2:         8/8s