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

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