Thursday, 31 July 2014

Change putty annoying blue with your login script

I love putty and I also hate it.  I love it coz it’s cool, one file, simple, great… I hate the default colour of folders, I know I’m getting old – but only freaks can read royal blue on black.  Colours that are being passed back to putty rely on the following environment variable – LS_COLORS [sic].  I stole most of this from http://sshadmincontrol.com/change-directory-color-from-blue-to-something-readable-on-putty-a-quick-fix, but added some more explanation.

So, you can change this by sed’ing this env variable and setting a new colour! 

Type the command and you get:

export|grep COLO

declare -x LS_COLORS="no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:"

Enter the following command and you’ll see that the number 34 has changed, as so has the colour!

export LS_COLORS=$(echo $LS_COLORS | sed "s/di=\(..\);../di=\1;93/")

declare -x LS_COLORS="no=00:fi=00:di=00;93:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:"

So in your .profile or .bashrc or what ever, you can do the following:

image

Note that I chose 93 above, but you can choose the colour that you want.

31    Red
32    Green
33    Orange
34    Blue
35    Purple
36    Cyan
37    Grey
90    Dark grey
91    Light red
92    Light green
93    Yellow
94    Light blue
95    Light purple
96    Turquoise
97    White

Now that is totally RAD!

No comments:

Extending JDE to generative AI