colouring in the Terminal

Scott P recently sent me an email which mentioned his discovery that you can change the colour of the text and backgrounds (as well as transparency) of each Apple Terminal window.

For those of you who haven’t found these settings, select Window Settings… under the Terminal menu and then choose the Color menu option. Apple’s default is black text on a white background, rather like the default for most windows on the Mac since way back when. Personally, I’ve been using orange on black and green on black for nostalgic reasons since I first got my hands on OS X.

You can also modify the font and the look of the cursor/prompt from within the Display menu option. Again, for nostalgic reasons, I like a blinking block. But, hey, the first computer I ever used on a regular basis was an Apple ][ with a green screen monitor and the first computer I ever owned had an amber monitor. Happy days :-)

Anywho, my conversation with Scott reminded me of a couple of things I’ve found in addition to playing around with the above that may benefit/interest some of you. The first is the use of the “-G” argument when using the “ls” command line directory listing command. This argument will colourise the output making it visually obvious which items are files, folders, executable, hidden, etc. If you like this, make either a new command like “lc” using an alias, or simply replace the existing ls command with an alias to ls -G and add to your .bash_profile or .profile file. Something like alias ls="ls -G" will do the trick.

Another useful thing to have is Mike Solomon’s TerminalColors. It adds a new pane to the Window Settings… menu option mentioned above that allows you to tweak the colours used by the terminal for displaying text. Some colours (like blue) are almost impossible to read clearly over black.

My final thought on colour which may be interesting to some of you is a thing I saw on Mac OS X hints a while back. An anonymous poster submitted a script for tcsh that randomly changes the background and text colour of each new Terminal window as they are created. An interesting conversation follows with many of other ideas about how this can be done more efficiently. I haven’t used any of that stuff myself – but it occurs to me that it might be useful to have a script that automatically changes the tint of a Terminal window when something is being executed as root or privileges have been elevated using sudo.