Wednesday, August 17, 2011

OS X Lion Terminal Colours

Just a small reminder to myself courtesy of Rowan Watson.

LSCOLORS in ~/.bash_profile

The first thing you need to do is edit ~/.bash_profile and put this code in to make folders color:

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

LSCOLORS Options

LSCOLORS has the ability to use 11 different indicators to set background and foreground colors:
  1. directory
  2. symbolic link
  3. socket
  4. pipe
  5. executable
  6. block special
  7. character special
  8. executable with setuid bit set
  9. executable with setgid bit set
  10. directory writable to others, with sticky bit
  11. directory writable to others, without sticky bit
Possible letter values to associate with the above numbers. Each indicator expects a pair of letters covering both foreground and background:
  • a black
  • b red
  • c green
  • d brown
  • e blue
  • f magenta
  • c cyan
  • h light grey
  • A block black, usually shows up as dark grey
  • B bold red
  • C bold green
  • D bold brown, usually shows up as yellow
  • E bold blue
  • F bold magenta
  • G bold cyan
  • H bold light grey; looks like bright white
  • x default foreground or background
Ex means bold blue foreground and default background for directories.

Lion Support

Lion provides support to override the color values associated with the above letters. The default colors always seem conflict with any terminal theme choice. Overriding should allow one to finally get that terminal perfect terminal theme and associated ANSI colours. Easily configured from the terminal.app preferences dialog.