Ticket #43159

Allow macro language to set window foreground and background color

Open Date: 2021-11-04 05:40 Last Update: 2021-11-04 21:37

5 - Medium
5 - Medium
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)


To benefit test systems that use macros to operate (for example to run certain commands on electronics being manufactured), it could be helpful to be able to change the overall screen foreground/background color of the TeraTerm window using macro commands. For instance, during a test, the screen could have a blue background. But when a test is done, it could change to green or red for pass or fail. This would help get an operator's attention to come over to the tester and do something.

I have not explored if I can get special terminal control codes to achieve this result, but it would be nice if special characters were not required to be transferred in case that interfered with colors sent by the remote system.

Ticket History (2/2 Histories)

2021-11-04 05:40 Updated by: mbendzick
  • New Ticket "Allow macro language to set window foreground and background color" created
2021-11-04 21:37 Updated by: doda

You can use dispstr command with OSC control string.


bg_red = #$1B"]11;#ff0000"#$1B"\"
fg_green = #$1B"]10;#00ff00"#$1B"\"
reset_color = #$1B"]110;111"#$1B"\"
dispstr bg_red fg_green
pause 5
dispstr reset_color
pause 5
; Use sprintf2 command to generate a change color control string.
osc_base = #$1B"]%d;#%02x%02x%02x"#$1B"\"
sprintf2 fg_black   osc_base 10 $00 $00 $00
sprintf2 fg_red     osc_base 10 $ff $00 $00
sprintf2 fg_green   osc_base 10 $00 $ff $00
sprintf2 fg_yellow  osc_base 10 $ff $ff $00
sprintf2 fg_blue    osc_base 10 $00 $00 $ff
sprintf2 fg_magenta osc_base 10 $ff $00 $ff
sprintf2 fg_cyan    osc_base 10 $00 $ff $ff
sprintf2 fg_white   osc_base 10 $ff $ff $ff
sprintf2 bg_black   osc_base 11 $00 $00 $00
sprintf2 bg_red     osc_base 11 $ff $00 $00
sprintf2 bg_green   osc_base 11 $00 $ff $00
sprintf2 bg_yellow  osc_base 11 $ff $ff $00
sprintf2 bg_blue    osc_base 11 $00 $00 $ff
sprintf2 bg_magenta osc_base 11 $ff $00 $ff
sprintf2 bg_cyan    osc_base 11 $00 $ff $ff
sprintf2 bg_white   osc_base 11 $ff $ff $ff
dispstr fg_white bg_black
pause 1
dispstr bg_red
pause 1
dispstr bg_green
pause 1
dispstr bg_yellow
pause 1
dispstr bg_blue
pause 1
dispstr bg_magenta
pause 1
dispstr bg_cyan
pause 1
dispstr bg_white
pause 1
dispstr reset_color

Attachment File List

No attachments


You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login