Skip to content

Instantly share code, notes, and snippets.

@tomviner
Created March 13, 2013 17:24
Show Gist options
  • Save tomviner/5154278 to your computer and use it in GitHub Desktop.
Save tomviner/5154278 to your computer and use it in GitHub Desktop.
Bash prompt colours, including coping with venvs
# colours are from http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
# in $WORKON_HOME/postactivate
PS1="(`basename $VIRTUAL_ENV`)$BASE_PS1"
# in $WORKON_HOME/postdeactivate
PS1=$BASE_PS1
# in startup eg ~/.bashrc
BASE_PS1="\[\033[00m\]\[\033[1;36m\]\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\[\033[0m\]\$ "
PS1=$BASE_PS1
@jaymzcd
Copy link

jaymzcd commented Mar 13, 2013

This is the madness I'm using:

    export NONE='\[\033[0m\]'
    export WHITE_1='\[\033[0;1m\]'
    export BLACK='\[\033[0;30m\]'
    export GRAY='\[\033[1;30m\]'
    export RED='\[\033[0;31m\]'
    export LIGHT_RED='\[\033[1;31m\]'
    export GREEN='\[\033[0;32m\]'
    export LIGHT_GREEN='\[\033[1;32m\]'
    export BROWN='\[\033[0;33m\]'
    export YELLOW='\[\033[1;33m\]'
    export BLUE='\[\033[0;34m\]'
    export LIGHT_BLUE='\[\033[1;34m\]'
    export PURPLE='\[\033[0;35m\]'
    export LIGHT_PURPLE='\[\033[1;35m\]'
    export CYAN='\[\033[0;36m\]'
    export LIGHT_CYAN='\[\033[0;1;36m\]'
    export LIGHT_GRAY='\[\033[0;37m\]'
    export WHITE='\[\033[1;37m\]'
    export BRACE_COLOR=$NONE
    export LBRACE=$BRACE_COLOR[$BRACE_COLOR
    export RBRACE=$BRACE_COLOR]$BRACE_COLOR

    export PS1=$LBRACE$LIGHT_BLUE'$(date +%H:%M)'$RBRACE$LBRACE$BROWN'\h'$RBRACE$LBRACE$GREEN'\u'$RBRACE$LBRACE$LIGHT_RED'\W'$RBRACE$LIGHT_GREEN'$(__git_ps1 "[%s]")'$LIGHT_PURPLE\$$NONE' '

GIves me something like:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment