NYCPHP Meetup

NYPHP.org

[nycphp-talk] Conditional Terminal Coloration (was developer's machine specs -- recomendations?)

Michael B Allen ioplex at gmail.com
Mon Oct 19 18:16:42 EDT 2009


On Mon, Oct 19, 2009 at 4:17 PM, Glenn Powell <glenn310b at mac.com> wrote:
> A little off topic now...
>
> Took me a day or 2 to get used to a white background.
>
> Btw, I use vim,  and open white backgrounds for my dev, and use different
> colors for ssh to  db servers, production web servers, etc.
>
> I think it helps to avoid confusion and potential problems, especially when
> I'm tired.

I do exactly the same thing with xtermcontrol on Linux. In
/etc/profile.d/x.sh I have:

. /etc/xterm_colorize

where /etc/extern_colorize is:

BG=#111
FG=#ccc

BG_ROOT=#200
BG_MYUSERNAME=#002
FG_REMOTE=#cf8

if [ -x /usr/local/bin/xtermcontrol ]; then
        if [ -z "$XC_RESET" ]; then
                if [ -n "$SSH_CLIENT" -o -n "$SSH_CONNECTION" ]; then
                        FG=$FG_REMOTE
                fi
                case "$USER" in
                        'root')
                        BG=$BG_ROOT
                        ;;
                        'myusername')
                        BG=$BG_MYUSERNAME                        ;;
                esac
        fi

        xtermcontrol --bg $BG --fg $FG
fi

This changes the background color depending on who I'm logged in as
and it also independently changes the foreground color if I'm
connected remotely over SSH.

To reset the colors back, I have the following in ~/.bash_logout:

XC_RESET=1 . /etc/xterm_colorize

Mike

-- 
Michael B Allen
Java Active Directory Integration
http://www.ioplex.com/



More information about the talk mailing list