Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /branches/ttcomtester/tests/color-sgr-decscnm.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10196 - (hide annotations) (download) (as text)
Sat Aug 27 14:08:07 2022 UTC (19 months, 2 weeks ago) by zmatsuo
Original Path: trunk/tests/color-sgr-decscnm.pl
File MIME type: text/x-perl
File size: 3672 byte(s)
各種文字色設定テストのパターンを追加
1 zmatsuo 10192
2     local $| = 1;
3    
4     print "\x1b[0m";
5     print "SGR(Select Graphic Rendition) test\n";
6    
7     if (1) {
8     print "==================== support attributes\n";
9    
10     print "\x1b[0m";
11     print "Normal / SGR 0";
12     print "\x1b[0m";
13     print "\n";
14    
15     print "\x1b[39m";
16     print "\x1b[49m";
17     print "Normal / SGR 39, 49";
18     print "\x1b[0m";
19     print "\n";
20    
21     print "\x1b[1m";
22     print "Bold / SGR 1";
23     print "\x1b[0m";
24     print "\n";
25    
26     print "\x1b[4m";
27     print "Underline / SGR 4";
28     print "\x1b[0m";
29     print "\n";
30    
31     print "\x1b[5m";
32     print "Blink(Slow blink) / SGR 5";
33     print "\x1b[0m";
34     print "\n";
35    
36     print "\x1b[7m";
37     print "Reverse / SGR 7";
38     print "\x1b[0m";
39     print "\n";
40    
41     print "\x1b[0m";
42     print "https://ttssh2.osdn.jp/ SGR 0(Normal) + URL string\n";
43    
44     print "\x1b[0m\x1b[31m";
45     print "RED / SGR 0 + SGR 31(FG Red)";
46     print "\x1b[0m";
47     print "\n";
48    
49     print "\x1b[0m\x1b[42m";
50     print "RED / SGR 0 + SGR 42(BG Greed)";
51     print "\x1b[0m";
52     print "\n";
53    
54     print "\x1b[31m\x1b[42m";
55     print "RED / SGR 31(FG Red) + SGR 42(BG Greed)";
56     print "\x1b[0m";
57     print "\n";
58    
59     print "\x1b[1m\x1b[41m";
60     print "BOLD + BG RED / SGR 1 + SGR 41(BG Red)";
61     print "\x1b[0m";
62     print "\n";
63    
64     print "\x1b[5m\x1b[46m";
65     print "Blink(Slow blink) / SGR 5 + SGR 46(BG Cyan)";
66     print "\x1b[0m";
67     print "\n";
68    
69     print "\x1b[5m\x1b[106m";
70     print "Blink(Slow blink) / SGR 5 + SGR 106(BG Bright Cyan)";
71     print "\x1b[0m";
72     print "\n";
73    
74     print "\x1b[4m\x1b[44m";
75     print "Underline / SGR 4 + SGR 44(BG Blue)";
76     print "\x1b[0m";
77     print "\n";
78    
79     print "\x1b[4m\x1b[104m";
80     print "Underline / SGR 4 + SGR 104(BG Bright Blue)";
81     print "\x1b[0m";
82     print "\n";
83     }
84    
85     if (1) {
86     print "==================== ANSI color\n";
87    
88     print "\x1b[0m";
89    
90 zmatsuo 10196 print "3bit(8) Standard color / 4bit(16) Darker color\n";
91 zmatsuo 10192 print " FG: SGR 30..37 m BG: SGR 40..47 m\n";
92     for ($f = 0; $f < 8; $f++) {
93     for ($b = 0; $b < 8; $b++) {
94     printf("\x1b[%d;%dm %3d/%3d ", $f + 30, $b + 40, $f + 30, $b + 40);
95     }
96     print "\x1b[0m";
97     print "\n";
98     }
99     print "\x1b[0m";
100     print "\n";
101    
102 zmatsuo 10196 if (1) {
103     print "aixterm 4bit(16) bright color\n";
104     print " FG: SGR 90..97 m BG: SGR 100..107 m\n";
105     for ($f = 0; $f < 8; $f++) {
106     for ($b = 0; $b < 8; $b++) {
107     printf("\x1b[%d;%dm %3d/%3d ", $f + 90, $b + 100, $f + 90 , $b + 100);
108     }
109     print "\x1b[0m";
110     print "\n";
111 zmatsuo 10192 }
112     }
113    
114 zmatsuo 10196 if (1) {
115     print "PC-Style 4bit(16) bright color\n";
116     print " FG: SGR 30..37 m BG: SGR 40..47 m\n";
117     for ($f = 0; $f < 8; $f++) {
118     for ($b = 0; $b < 8; $b++) {
119     print "\x1b[1m";
120     printf("\x1b[%d;%dm %3d/%3d ", $f + 30, $b + 40, $f + 30, $b + 40);
121     }
122     print "\x1b[0m";
123     print "\n";
124 zmatsuo 10192 }
125     print "\x1b[0m";
126     print "\n";
127     }
128 zmatsuo 10196
129     if (1) {
130     print "PC 4bit(16) color\n";
131     print " FG: SGR 38 ; 5 ; n m BG: 48 ; 5 ; n m (256color only)\n";
132     for ($f = 0; $f < 8; $f++) {
133     for ($b = 0; $b < 8; $b++) {
134     printf("\x1b[38;5;%dm\x1b[48;5;%dm %3d/%3d ", $f, $b, $f, $b);
135     }
136     print "\x1b[0m";
137     print "\n";
138     }
139     for ($f = 0; $f < 8; $f++) {
140     for ($b = 0; $b < 8; $b++) {
141     printf("\x1b[38;5;%dm\x1b[48;5;%dm %3d/%3d ", $f + 8, $b + 8, $f + 8, $b + 8);
142     }
143     print "\x1b[0m";
144     print "\n";
145     }
146     }
147 zmatsuo 10192 }
148    
149     # DECSCNM 反転表示モード
150     # DECSET ESC [ ? 5 h 設定
151     # echo -en "\033[?5h"
152     # DECRST ESC [ ? 5 l 解除
153     # echo -en "\033[?5l"
154     if (1) {
155     print "==================== DECSCNM test\n";
156     for ($i = 0; $i < 50; $i++) {
157     sleep(1);
158     if (($i % 2) == 0) {
159     print "\x1b[?5h";
160     } else {
161     print "\x1b[?5l";
162     }
163     }
164     }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26