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 10242 - (hide annotations) (download) (as text)
Mon Sep 5 14:27:17 2022 UTC (19 months ago) by zmatsuo
Original Path: trunk/tests/color-sgr-decscnm.pl
File MIME type: text/x-perl
File size: 4462 byte(s)
カラーパレット変更シーケンスで誤った対象が変更される

- 正しく指定できない色番号
  - 1-7 -> 9-15
  - 9-15 -> 1-7
- color-sgr-decscnm.pl
  - OSCシーケンス 色設定テストを追加

ticket #45558
1 nmaya 10207 #!/usr/bin/perl
2 nmaya 10206
3     local $| = 1;
4    
5 zmatsuo 10242 sub pause {
6     printf("pause(hit enter)\n");
7     <STDIN>;
8     }
9    
10 nmaya 10206 print "\x1b[0m";
11     print "SGR(Select Graphic Rendition) test\n";
12    
13     if (1) {
14     print "==================== support attributes\n";
15    
16     print "\x1b[0m";
17     print "Normal / SGR 0";
18     print "\x1b[0m";
19     print "\n";
20    
21     print "\x1b[39m";
22     print "\x1b[49m";
23     print "Normal / SGR 39, 49";
24     print "\x1b[0m";
25     print "\n";
26    
27     print "\x1b[1m";
28     print "Bold / SGR 1";
29     print "\x1b[0m";
30     print "\n";
31    
32     print "\x1b[4m";
33     print "Underline / SGR 4";
34     print "\x1b[0m";
35     print "\n";
36    
37     print "\x1b[5m";
38     print "Blink(Slow blink) / SGR 5";
39     print "\x1b[0m";
40     print "\n";
41    
42     print "\x1b[7m";
43     print "Reverse / SGR 7";
44     print "\x1b[0m";
45     print "\n";
46    
47     print "\x1b[0m";
48     print "https://ttssh2.osdn.jp/ SGR 0(Normal) + URL string\n";
49    
50     print "\x1b[0m\x1b[31m";
51     print "RED / SGR 0 + SGR 31(FG Red)";
52     print "\x1b[0m";
53     print "\n";
54    
55     print "\x1b[0m\x1b[42m";
56     print "RED / SGR 0 + SGR 42(BG Green)";
57     print "\x1b[0m";
58     print "\n";
59    
60     print "\x1b[31m\x1b[42m";
61     print "RED / SGR 31(FG Red) + SGR 42(BG Green)";
62     print "\x1b[0m";
63     print "\n";
64    
65     print "\x1b[7m\x1b[31m\x1b[42m";
66     print "Reverse / SGR 7 + SGR 31(FG Red) + SGR 42(BG Green)";
67     print "\x1b[0m";
68     print "\n";
69    
70     print "\x1b[1m\x1b[41m";
71     print "BOLD + BG RED / SGR 1 + SGR 41(BG Red)";
72     print "\x1b[0m";
73     print "\n";
74    
75     print "\x1b[5m\x1b[46m";
76     print "Blink(Slow blink) / SGR 5 + SGR 46(BG Cyan)";
77     print "\x1b[0m";
78     print "\n";
79    
80     print "\x1b[5m\x1b[106m";
81     print "Blink(Slow blink) / SGR 5 + SGR 106(BG Bright Cyan)";
82     print "\x1b[0m";
83     print "\n";
84    
85     print "\x1b[4m\x1b[44m";
86     print "Underline / SGR 4 + SGR 44(BG Blue)";
87     print "\x1b[0m";
88     print "\n";
89    
90     print "\x1b[4m\x1b[104m";
91     print "Underline / SGR 4 + SGR 104(BG Bright Blue)";
92     print "\x1b[0m";
93     print "\n";
94 zmatsuo 10233
95     print "\x1b[30m\x1b[40m";
96     print "Underline / SGR 30 + SGR 40 (FG&BG Black)";
97     print "\x1b[0m";
98     print "\n";
99    
100     print "\x1b[37m\x1b[47m";
101     print "Underline / SGR 37 + SGR 47 (FG&BG White(8color)/Gray(16,256color))";
102     print "\x1b[0m";
103     print "\n";
104    
105     print "\x1b[97m\x1b[107m";
106     print "Underline / SGR 97 + SGR 107 (FG&BG White(16,256color))";
107     print "\x1b[0m";
108     print "\n";
109 nmaya 10206 }
110    
111     if (1) {
112     print "==================== ANSI color\n";
113    
114     print "\x1b[0m";
115    
116     print "3bit(8) Standard color / 4bit(16) Darker color\n";
117     print " FG: SGR 30..37 m BG: SGR 40..47 m\n";
118     for ($f = 0; $f < 8; $f++) {
119     for ($b = 0; $b < 8; $b++) {
120     printf("\x1b[%d;%dm %3d/%3d ", $f + 30, $b + 40, $f + 30, $b + 40);
121     }
122     print "\x1b[0m";
123     print "\n";
124     }
125     print "\x1b[0m";
126     print "\n";
127    
128     if (1) {
129     print "aixterm 4bit(16) bright color\n";
130     print " FG: SGR 90..97 m BG: SGR 100..107 m\n";
131     for ($f = 0; $f < 8; $f++) {
132     for ($b = 0; $b < 8; $b++) {
133     printf("\x1b[%d;%dm %3d/%3d ", $f + 90, $b + 100, $f + 90 , $b + 100);
134     }
135     print "\x1b[0m";
136     print "\n";
137     }
138     }
139    
140     if (1) {
141     print "PC-Style 4bit(16) bright color\n";
142     print " FG: SGR 30..37 m BG: SGR 40..47 m\n";
143     for ($f = 0; $f < 8; $f++) {
144     for ($b = 0; $b < 8; $b++) {
145     print "\x1b[1m";
146     printf("\x1b[%d;%dm %3d/%3d ", $f + 30, $b + 40, $f + 30, $b + 40);
147     }
148     print "\x1b[0m";
149     print "\n";
150     }
151     print "\x1b[0m";
152     print "\n";
153     }
154    
155     if (1) {
156     print "PC 4bit(16) color\n";
157     print " FG: SGR 38 ; 5 ; n m BG: 48 ; 5 ; n m (256color only)\n";
158     for ($f = 0; $f < 8; $f++) {
159     for ($b = 0; $b < 8; $b++) {
160     printf("\x1b[38;5;%dm\x1b[48;5;%dm %3d/%3d ", $f, $b, $f, $b);
161     }
162     print "\x1b[0m";
163     print "\n";
164     }
165     for ($f = 0; $f < 8; $f++) {
166     for ($b = 0; $b < 8; $b++) {
167     printf("\x1b[38;5;%dm\x1b[48;5;%dm %3d/%3d ", $f + 8, $b + 8, $f + 8, $b + 8);
168     }
169     print "\x1b[0m";
170     print "\n";
171     }
172     }
173     }
174    
175 zmatsuo 10242 # OSC��������������� ���������
176     if (1) {
177     print "==================== OSC test\n";
178     pause();
179    
180     printf("black-white\n");
181     for ($i = 0; $i < 16; $i++) {
182     printf("\x1b]4;%d;#%1x%1x%1x\x1b\\", $i, $i, $i, $i);
183     }
184     pause();
185    
186     printf("reset color\n");
187     for ($i = 0; $i < 16; $i++) {
188     printf("\x1b]104;%d\x1b\\", $i, $i, $i, $i);
189     }
190     }
191    
192 nmaya 10206 # DECSCNM ���������������������
193     # DECSET ESC [ ? 5 h ������
194     # echo -en "\033[?5h"
195     # DECRST ESC [ ? 5 l ������
196     # echo -en "\033[?5l"
197     if (1) {
198     print "==================== DECSCNM test\n";
199     for ($i = 0; $i < 50; $i++) {
200     if (($i % 2) == 0) {
201     print "\x1b[?5l";
202     } else {
203     print "\x1b[?5h";
204     }
205     sleep(1);
206     }
207 nmaya 10207 print "\x1b[?5l";
208 nmaya 10206 }

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