 |
» |
|
|
 |
Ask the Wizard Questions
DECterm text color
The Question is:
Dear Wizard,
I'm in seoul, korea.
I tried to find out how to get color text at DECterm in
OpenVMS/AXP for days. but just failed.
you know, I coded some C program which produce
"hello, world" in reverse
video mode or be underlined like the following :
main()
{
/* "[7mhello,world[m" */
putchar(0x1b);
putchar('[');
putchar('7');
putchar('m');
printf("hello, world\n");
putchar(0x1b);
putchar('[');
putchar('m');
}
and I succeeded.
But I couldn't find out how to get RED "hello, world" or
BLUE "hello, world" at DECterm in OpenVMS/AXP.
I think that getting a RED or BLUE text is similar to
that of reverse.
Please help me. And I would appreciate your kindness.
Thanks.
The Answer is:
I wrote this DCL some time ago (COLORS.COM):
$!
$ esc[0,7]=27
$ black == 0
$ red == 1
$ green == 2
$ yellow == 3
$ blue == 4
$ purple == 5
$ lightblue == 6
$ white == 7
$ foreground == 30
$ background == 40
$ normal == "''esc'[0m"
$ ws:= write sys$output
$ color0 = "black"
$ color1 = "red"
$ color2 = "green"
$ color3 = "yellow"
$ color4 = "blue"
$ color5 = "purple"
$ color6 = "lightblue"
$ color7 = "white"
$!
$!
$ ws "Demonstrating changed foregrounds"
$ counter = 0
$ loop1:
$ bg = 0 ! "normal" background
$ fg = 30 + counter
$ a = color'counter'
$ ws "''esc'[''bg';''fg'm", "This is ", ''a', normal
$ counter = counter + 1
$ if counter .lt. 8 then goto loop1
$!
$ ws "Demonstrating changed backgrounds"
$ counter = 0
$ loop2:
$ bg = 40 + counter
$ fg = 30 ! "black" foreground
$ a = color'counter'
$ ws "''esc'[''bg';''fg'm", "This is ", ''a', normal
$ counter = counter + 1
$ if counter .lt. 8 then goto loop2
$ exit
|