You can change default text and background colors programmatically from server scripts in Token2Shell.
This feature should be handy if you frequently use 'su' (switch user) command. For example, you can use it to change the background color to red when you change your user ID to 'root' for system administrative work.
Set | Reset | |
---|---|---|
Text Color | <ESC>]10;#{RRGGBB}<BEL> | <ESC>]110;<BEL> |
Background Color | <ESC>]11;#{RRGGBB}<BEL> | <ESC>]111;<BEL> |
When you specify a color, you need to use the RGB (Red, Green, Blue) notation used in HTML. For example, when you need to set the background color to orange (R: 0xff, G: 0xa5, B: 0x00);
<ESC>]11;#ffa500<BEL>
When you issue a reset command, the color is set back to the original color when you started the session (it's not the current color you set in global options or address book).
Script Example: tcsh
If you want to change text and background colors when you login, we recommend updating .cshrc file.
# Change text color to #ffff00 (yellow) echo -ne "\033]10;#ffff00\007" # Change background color to #800000 (maroon) echo -n "^[]11;#800000^G" # Change colors back to the defaults when exit/logout alias exit 'echo -n "^[]110;^G^[]111;^G";""exit'
Please note that '^[' and '^G' shown above are control characters, <ESC> and <BEL> respectively. Control characters can be entered in tcsh command prompt by pressing <CTRL> + V and then the actual control character. For example, if you wish to enter <ESC> control character, press <CTRL> + V and then hit <ESC> key.
Please also note that '""exit' shown above are for issuing the original 'exit' command instead of the aliased one.
Script Example: bash
If you want to change text and background colors when you login, we recommend updating .bashrc file.
# Change text color to #ffff00 (yellow) echo -ne "\033]10;#ffff00\007" # Change background color to #800000 (maroon) echo -ne "\033]11;#800000\007" # Change colors back to the defaults when exit/logout alias exit='echo -ne "\033]110;\007\033]111;\007";""exit'
Color Examples
#1BA1E2 | |
#A05000 | |
#339933 | |
#A2C139 | |
#D80073 | |
#F09609 | |
#E671B8 | |
#A200FF | |
#E51400 | |
#00ABA9 |
#FF0000 | |
#FFA500 | |
#800000 | |
#A52A2A | |
#FF00FF | |
#800080 |
#00FF00 | |
#008000 | |
#FFFF00 | |
#808000 |
#0000FF | |
#0000A0 | |
#00FFFF | |
#ADD8E6 |
#FFFFFF | |
#C0C0C0 | |
#808080 | |
#000000 |