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