From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 17-MAY-1994 12:21:42.94
To:	EVERHART
CC:	
Subj:	Re: DECTerm Colors via ESC sequences

From: bach@devbn0.triumf.ca (Fred W. Bach, Co-ordinator, TRIUMF Operations)
X-Newsgroups: comp.os.vms
Subject: Re: DECTerm Colors via ESC sequences
Date: 17 May 1994 08:02 PST
Organization: TRIUMF: Tri-University Meson Facility
Lines: 409
Distribution: world
Message-ID: <17MAY199408021243@devbn0.triumf.ca>
NNTP-Posting-Host: devbn0.triumf.ca
News-Software: VAX/VMS VNEWS 1.41    
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET

In article <2r9ivs$qgc@pipeline.com>, mccready@pipeline.com (Gary McCready) writes...
#Is it possible to change DECTerm screen colors via escape 
#sequences? If so, how?
# 
#Thanks in advance!
# 

   Well, sort of.  I haven't figured out how to do the screens themselves yet,
 but I do have something to select light or dark screen and to select the
 colour of text on the screen.  Here is my VT300.com file.  I have included
 the information for the VT300_series terminals for reference only.  This
 command procedure is still under development.  Presently it takes only
 one argument.  From the many IF statements inside it, you can see what
 those arguments are.

$! VT300.com  .  Pieced together by F.W.Bach, TRIUMF Operations April 1994.
$!
$! The VT330 and VT340 are described by /DEVICE=VT300_SERIES.  
$!
$ goto BEGIN

NAME = "VT300_Series"

	BOOLEAN
	ansi_crt = 1,		auto_margin = 1,	backspace = 1,
	dec_crt = 1,		eight_bit = 1,		scope = 1,
	lowercase = 1,		edit = 1,		printer_port = 1,
	dec_crt_2 = 1,		no_scroll = 0,		physical_tabs = 1,
	block_mode = 1,		underline = 1,		cursor_report_ansi = 1,
	soft_characters = 1,	dec_crt_3 = 1

	NUMERIC
	columns = 80,		rows = 24,	wide_screen_columns = 132

	STRING
	truncation_icon="`",	cr_graphic="d",	ff_graphic="c",
	lf_graphic="e",		ht_graphic="b",	vt_graphic="i",
	cursor_position_report = "$[!UL;!ULR", request_cursor_position = "$[6n",
	sel_erase_to_end_display = "$[?0J", sel_erase_to_end_line = "$[?0K",
	sel_erase_whole_display = "$[?2J",  sel_erase_whole_line = "$[?2K",
	set_char_not_sel_erase = "$[2_"q",   set_char_sel_erase = "$[1_"q",
	index = "$D", reverse_index = "$M", newline_char = "h",
	cursor_next_line = "$[1L",	error_icon="^Z",
	device_attributes = "$[?63;1;2;6;7;8;9;11;13;15;17;18;19;21c",
	begin_alternate_char = "^N",	begin_line_drawing_char = "^N"
	begin_normal_rendition = "$[m",end_line_drawing_char = "^O"
	begin_blink = "$[5m",		begin_bold = "$[1m",
	set_application_keypad = "$=",	begin_reverse = "$[7m",
	begin_underscore = "$[4m",	bottom_t_char = "v",
	clear_tab = "$[g",		cross_char = "n",
	cursor_down = "$[!ULB",		cursor_left = "$[!ULD",
	cursor_right = "$[!ULC",	cursor_up = "$[!ULA",		
	dark_screen = "$[?5l",		double_high_bottom = "$#4",
	double_high_top = "$#3",	double_wide = "$#6",
	end_alternate_char = "^O",	end_blink = "$[25m",
	end_bold = "$[22m",		set_numeric_keypad = "$>",
	end_reverse = "$[27m",	       	end_underscore = "$[24m",
	erase_to_end_display = "$[J",	erase_to_end_line = "$[K",
	erase_whole_display = "$[2J",	erase_whole_line = "$[2K",
	home = "$[;H",			horizontal_bar = "q",
	left_t_char = "t",		light_screen = "$[?5h",
	lower_left_corner = "m",	lower_right_corner = "j",
	restore_cursor = "$8",		right_t_char = "u",
	save_cursor = "$7",		scroll_forward = "$D",
	scroll_reverse = "$M",		set_cursor_abs = "$[!UL;!ULH",
	set_tab = "$H",			single_high = "$#5",
	top_t_char = "w",		upper_left_corner = "l",
	upper_right_corner = "k",	vertical_bar = "x",
	width_narrow = "$[?3l",		width_wide = "$[?3h",
	init_string = '$)0$[4l',	set_scroll_region = "$[!UL;!ULr",
	cursor_preceding_line = "$[!UL;0H",
	begin_autoprint_mode = "$[?5i",	end_autoprint_mode = "$[?4i",
	begin_autowrap_mode = "$[?7h", 	end_autowrap_mode = "$[?7l",
	begin_autorepeat_mode = "$[?8h", end_autorepeat_mode = "$[?8l",
	print_screen = "$[10i",		erase_line_to_cursor = "$[1K",
	set_cursor_on = "$[?25h",	set_cursor_off = "$[?25l",
	set_printer_output = "$[5i",	set_screen_output = "$[4i",
	set_origin_absolute = "$[?6l",	set_origin_relative = "$[?6h",
	next_line = "$E",		erase_display_to_cursor = "$[1J",
	insert_char = "$[!UL_@",	delete_char = "$[!ULP",
	insert_line = "$[!ULL",		delete_line = "$[!ULM",
	begin_insert_mode = "$[4h",	end_insert_mode = "$[4l",
	begin_delete_mode = "$[4l",	end_delete_mode = "$[4h",
	request_printer_status = "$[?15n", no_printer = "$[?13n",
	printer_ready = "$[?10n",	printer_not_ready = "$[?11n",
	set_jump_scroll= "$[?4l",  	set_smooth_scroll = "$[?4h",
	page_length = "$[!ULt",

	key_0 = "$Op", key_1 = "$Oq", key_2 = "$Or", key_3 = "$Os", 
	key_4 = "$Ot", key_5 = "$Ou", key_6 = "$Ov", key_7 = "$Ow", 
	key_8 = "$Ox", key_9 = "$Oy", 
	key_comma = "$Ol", 	key_minus = "$Om", 	key_period = "$On", 
	key_enter = "$OM",	key_pf1 = "$OP", 	key_pf2 = "$OQ", 
	key_pf3 = "$OR", 	key_pf4 = "$OS", 	key_down_arrow = "$[B", 
	key_left_arrow = "$[D",	key_right_arrow = "$[C", key_up_arrow = "$[A",
	key_f6 = "$[17~", key_f7 = "$[18~", key_f8 = "$[19~", key_f9 = "$[20~",
	key_f10 = "$[21~", key_f11 = "$[23~", key_f12 = "$[24~", 
	key_f13 = "$[25~", key_f14 = "$[26~", key_f15 = "$[28~", 
	key_f16 = "$[29~", key_f17 = "$[31~", key_f18 = "$[32~", 
	key_f19 = "$[33~", key_f20 = "$[34~",
	key_e1 = "$[1~", key_e2 = "$[2~", key_e3 = "$[3~",
	key_e4 = "$[4~", key_e5 = "$[5~", key_e6 = "$[6~"

	STRING_2
	black_screen   = "$PpS_(M0_(AD))$\", blue_screen   = "$PpS_(M0_(AB))$\",
	cyan_screen    = "$PpS_(M0_(AC))$\", green_screen  = "$PpS_(M0_(AG))$\",
	magenta_screen = "$PpS_(M0_(AM))$\", red_screen    = "$PpS_(M0_(AR))$\",
	white_screen   = "$PpS_(M0_(AW))$\", yellow_screen = "$PpS_(M0_(AY))$\"
	begin_status_line = "$[2_$~$[1_$}",  end_status_line = "$[0_$}"
	key_first_down = "$[241~",           key_second_down = "$[243~", 
	key_third_down = "$[245~",           key_fourth_down = "$[247~"
	key_first_up = "$[242~",             key_second_up = "$[244~", 
	key_third_up = "$[246~",             key_fourth_up = "$[248~"

! The following definitions were added for the VaxStation emulator

	begin_locator = "$[2;2_'z$[0;1;3_'{",
	end_locator = "$[0_'z",
	begin_user1 = "$[30m",		end_user1 = "$[m",
	begin_user2 = "$[34m",		end_user2 = "$[m",
	begin_user3 = "$[36m",		end_user3 = "$[m",
	begin_user4 = "$[32m",		end_user4 = "$[m",
	begin_user5 = "$[35m",		end_user5 = "$[m",
	begin_user6 = "$[31m",		end_user6 = "$[m",
	begin_user7 = "$[37m",		end_user7 = "$[m",
	begin_user8 = "$[33m",		end_user8 = "$[m",
	user1_screen = "$[40m",		user2_screen = "$[44m",
	user3_screen = "$[46m",		user4_screen = "$[42m",
	user5_screen = "$[45m",		user6_screen = "$[41m",
	user7_screen = "$[47m",		user8_screen = "$[43m"

	END

NAME = "VT300_8Bit"

	BOOLEAN
	ansi_crt = 1,		auto_margin = 1,	backspace = 1,
	dec_crt = 1,		eight_bit = 1,		scope = 1,
	no_scroll = 0,		physical_tabs = 1,	lowercase = 1,
	edit = 1,		printer_port = 1,	dec_crt_2 = 1,
	block_mode = 1,		cursor_report_ansi = 1,	underline = 1,
	soft_characters = 1,	dec_crt_3 = 1

	NUMERIC
	columns = 80,		rows = 24,	wide_screen_columns = 132

	STRING
	truncation_icon="`",	cr_graphic="d",	ff_graphic="c",
	lf_graphic="e",		ht_graphic="b",	vt_graphic="i",
	cursor_position_report = "&!UL;!ULR", request_cursor_position = "&6n",
	sel_erase_to_end_display = "&?0J", sel_erase_to_end_line = "&?0K",
	sel_erase_whole_display = "&?2J",  sel_erase_whole_line = "&?2K",
	set_char_not_sel_erase = "&2_"q",   set_char_sel_erase = "&1_"q",
	index = "$D", reverse_index = "$M", newline_char = "h",
	device_attributes = "&?63;1;2;6;7;8;9;11;13;15;17;18;19;21c",
	cursor_next_line = "&1L",	error_icon="^Z",
	begin_alternate_char = "^N",	begin_normal_rendition = "&m",
	begin_line_drawing_char = "^N",	end_line_drawing_char = "^O"
	begin_blink = "&5m",		begin_bold = "&1m",
	set_application_keypad = "$=",	begin_reverse = "&7m",
	begin_underscore = "&4m",	bottom_t_char = "v",
	clear_tab = "&g",		cross_char = "n",
	cursor_down = "&!ULB",		cursor_left = "&!ULD",
	cursor_right = "&!ULC",		cursor_up = "&!ULA",		
	dark_screen = "&?5l",		double_high_bottom = "$#4",
	double_high_top = "$#3",	double_wide = "$#6",
	end_alternate_char = "^O",	end_blink = "&25m",
	end_bold = "&22m",		set_numeric_keypad = "$>",
	end_reverse = "&27m",		end_underscore = "&24m",
	erase_to_end_display = "&J",	erase_to_end_line = "&K",
	erase_whole_display = "&2J",	erase_whole_line = "&2K",
	home = "&;H",			horizontal_bar = "q",
	left_t_char = "t",		light_screen = "&?5h",
	lower_left_corner = "m",	lower_right_corner = "j",
	restore_cursor = "$8",		right_t_char = "u",
	save_cursor = "$7",		scroll_forward = "$D",
	scroll_reverse = "$M",		set_cursor_abs = "&!UL;!ULH",
	set_tab = "$H",			single_high = "$#5",
	top_t_char = "w",		upper_left_corner = "l",
	upper_right_corner = "k",	vertical_bar = "x",
	width_narrow = "&?3l",		width_wide = "&?3h",
	init_string = '$)0&4l',		set_scroll_region = "&!UL;!ULr",
	next_line = "$E",		cursor_preceding_line = "&!UL;0H",
	begin_autoprint_mode = "&?5i",	end_autoprint_mode = "&?4i",
	begin_autowrap_mode = "&?7h", end_autowrap_mode = "&?7l",
	begin_autorepeat_mode = "&?8h", end_autorepeat_mode = "&?8l",
	print_screen = "&10i",		erase_line_to_cursor = "&1K",
	set_cursor_on = "&?25h",	set_cursor_off = "&?25l",
	set_printer_output = "&5i",	set_screen_output = "&4i",
	set_origin_absolute = "&?6l",	set_origin_relative = "&?6h",
	insert_char = "&!UL_@",		delete_char = "&!ULP",
	insert_line = "&!ULL",		delete_line = "&!ULM",
	begin_insert_mode = "&4h",	end_insert_mode = "&4l",
	begin_delete_mode = "&4l",	end_delete_mode = "&4h",
	request_printer_status = "&?15n", no_printer = "&?13n",
	printer_ready = "&?10n",	printer_not_ready = "&?11n",
	set_jump_scroll= "&?4l",	set_smooth_scroll = "&?4h",
	page_length = "&!ULt",

	key_0 = "@p", key_1 = "@q", key_2 = "@r", key_3 = "@s", 
	key_4 = "@t", key_5 = "@u", key_6 = "@v", key_7 = "@w", 
	key_8 = "@x", key_9 = "@y", 
	key_comma = "@l", 	key_minus = "@m", 	key_period = "@n", 
	key_enter = "@M",	key_pf1 = "@P", 	key_pf2 = "@Q", 
	key_pf3 = "@R", 	key_pf4 = "@S", 	key_down_arrow = "&B", 
	key_left_arrow = "&D",	key_right_arrow = "&C", key_up_arrow = "&A",
	key_f6 = "&17~", key_f7 = "&18~", key_f8 = "&19~", key_f9 = "&20~",
	key_f10 = "&21~", key_f11 = "&23~", key_f12 = "&24~", 
	key_f13 = "&25~", key_f14 = "&26~", key_f15 = "&28~", 
	key_f16 = "&29~", key_f17 = "&31~", key_f18 = "&32~", 
	key_f19 = "&33~", key_f20 = "&34~",
	key_e1 = "&1~", key_e2 = "&2~", key_e3 = "&3~",
	key_e4 = "&4~", key_e5 = "&5~", key_e6 = "&6~"

	STRING_2
	black_screen   = "$PpS_(M0_(AD))$\", blue_screen   = "$PpS_(M0_(AB))$\",
	cyan_screen    = "$PpS_(M0_(AC))$\", green_screen  = "$PpS_(M0_(AG))$\",
	magenta_screen = "$PpS_(M0_(AM))$\", red_screen    = "$PpS_(M0_(AR))$\",
	white_screen   = "$PpS_(M0_(AW))$\", yellow_screen = "$PpS_(M0_(AY))$\"
	begin_status_line = "&2_$~&1_$}",   end_status_line = "&0_$}"
	key_first_down = "&241~",           key_second_down = "&243~", 
	key_third_down = "&245~",           key_fourth_down = "&247~"
	key_first_up = "&242~",             key_second_up = "&244~", 
	key_third_up = "&246~",             key_fourth_up = "&248~"

! The following definitions were added for the VaxStation emulator

	begin_locator = "&2;2_'z&0;1;3_'{",
	end_locator = "&0_'z",
	begin_user1 = "&30m",		end_user1 = "&m",
	begin_user2 = "&34m",		end_user2 = "&m",
	begin_user3 = "&36m",		end_user3 = "&m",
	begin_user4 = "&32m",		end_user4 = "&m",
	begin_user5 = "&35m",		end_user5 = "&m",
	begin_user6 = "&31m",		end_user6 = "&m",
	begin_user7 = "&37m",		end_user7 = "&m",
	begin_user8 = "&33m",		end_user8 = "&m",
	user1_screen = "&40m",		user2_screen = "&44m",
	user3_screen = "&46m",		user4_screen = "&42m",
	user5_screen = "&45m",		user6_screen = "&41m",
	user7_screen = "&47m",		user8_screen = "&43m"

	END

$BEGIN:
$ SET TERM/DEVICE_TYPE=VT300/page='f$getdvt("tt:","TT_PAGE") !don't change the page length
$ ASSIGN/NOLOG DECWINDOWS TRIUMF_TERMINAL_TYPE
$ say = "WRITE SYS$OUTPUT"
$ ESC = ""
$ ESC[0,7] = 27
$
$LIGHT:
$ if P1 .eqs. "LIGHT" 
$  then
$   say ESC,"[?5h"
$ exit
$
$DARK:
$ endif
$ if P1 .eqs. "DARK" 
$  then
$   say ESC,"[?5l"
$ exit
$
$BLACK:
$ endif
$ if P1 .eqs. "BLACK"
$  then
$   say ESC,"[30m"
$ exit
$
$RED:
$ endif
$ if P1 .eqs. "RED" 
$  then
$   say ESC,"[31m"
$ exit
$ endif
$
$GREEN:
$ if P1 .eqs. "GREEN" 
$  then
$   say ESC,"[32m"
$ exit
$ endif
$
$YELLOW:
$ if P1 .eqs. "YELLOW"
$  then
$   say ESC,"[33m"
$ exit
$ endif
$
$BLUE:
$ if P1 .eqs. "BLUE" 
$  then
$   say ESC,"[34m"
$ exit
$ endif
$
$VIOLET:
$ if P1 .eqs. "VIOLET" 
$  then
$   say ESC,"[35m"
$ exit
$ endif
$
$CYAN:
$ if P1 .eqs. "CYAN" 
$  then
$   say ESC,"[36m"
$ exit
$ endif
$
$WHITE:
$ if P1 .eqs. "WHITE"
$  then
$   say ESC,"[37m"
$ exit
$ endif
$
$BOLD:
$ if P1 .eqs. "BOLD"
$  then
$   say ESC,"[1m"
$ exit
$ endif
$
$NOBOLD:
$ if P1 .eqs. "NOBOLD" .or. P1 .eqs. "NO_BOLD" .or. P1 .eqs. "ENDBOLD" .or. P1 .eqs. "END_BOLD"
$  then
$   say ESC,"[22m"
$ exit
$ endif
$
$REVERSE:
$ if P1 .eqs. "REVERSE"
$  then
$   say ESC,"[7m"
$ exit
$ endif
$
$NOREVERSE:
$ if P1 .eqs. "NOREVERSE" .or. P1 .eqs. "NO_REVERSE" .or. P1 .eqs. "ENDREVERSE" .or. P1 .eqs. "END_REVERSE"
$  then
$   say ESC,"[27m"
$ exit
$ endif
$
$BLINK:
$ if P1 .eqs. "BLINK"
$  then
$   say ESC,"[5m"
$ exit
$ endif
$
$NOBLINK:
$ if P1 .eqs. "NOBLINK" .or. P1 .eqs. "NO_BLINK" .or. P1 .eqs. "ENDBLINK" .or. P1 .eqs. "END_BLINK"
$  then
$   say ESC,"[25m"
$ exit
$ endif
$
$
$JUMP:
$ if P1 .eqs. "JUMP"
$  then
$   say ESC,"[?4l"
$ exit
$ endif
$
$NOJUMP:
$ if P1 .eqs. "NOJUMP" .or. P1 .eqs. "NO_JUMP" .or. P1 .eqs. "ENDJUMP" .or. P1 .eqs. "END_JUMP" .or. P1 .eqs. "SMOOTH"
$  then
$   say ESC,"[?4h"
$ exit
$ endif
$
$
$UNDERSCORE:
$ if P1 .eqs. "UNDERSCORE" .or. P1 .eqs. "UNDERLINE"
$  then
$   say ESC,"[4m"
$ exit
$ endif
$
$NOUNDERSCORE:
$ IF P1 .eqs. "NOUNDERSCORE" .or. P1 .eqs. "NO_UNDERSCORE" .or. P1 .eqs. "ENDUNDERSCORE" .or. P1 .eqs. "END_UNDERSCORE" -
 .or. P1 .eqs. "NOUNDERLINE" .or. P1 .eqs. "NO_UNDERLINE" .or. P1 .eqs. "ENDUNDERLINE" .or. P1 .eqs. "END_UNDERLINE" 
$  then
$   say ESC,"[24m"
$ exit
$ endif
$
$!
$!
$exit
set_cursor_on = "$[?25h",
set_cursor_off = "$[?25l",
***************************** end vt300.com ******************************

 Fred W. Bach                              |  Internet: music@erich.triumf.ca
 Co-ordinator, Operations Group            |        or: bach@devbn0.triumf.ca
 TRIUMF (TRI-University Meson Facility)    |  Voice:  604-222-1047 loc 327/333
 4004 WESBROOK MALL, UBC CAMPUS            |  FAX:    604-222-1074
 University of British Columbia, Vancouver, B.C., CANADA   V6T 2A3
  Damien says " If you don't STAND for SOMETHING, you'll FALL for ANYTHING "
 These are my opinions, which should ONLY make you read, think, and question.
 They do NOT necessarily reflect the views of my employer or fellow workers.

