Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2001 05:37:59 +0100
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        Trevin Chow <tmchow@sfu.ca>
Cc:        questions@FreeBSD.ORG
Subject:   Re: color prompts?
Message-ID:  <20010122053759.A1639@raggedclown.net>
In-Reply-To: <Pine.GSO.4.30.0101211429120.25541-100000@fraser.sfu.ca>; from tmchow@sfu.ca on Sun, Jan 21, 2001 at 02:31:20PM -0800
References:  <Pine.GSO.4.30.0101211429120.25541-100000@fraser.sfu.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 21, 2001 at 02:31:20PM -0800, Trevin Chow wrote:
> I'm looking at making my own prompt for bash and
> saw this color information on the web for one particular
> prompt:
> 
>   local COLOR1="\[\033[0;36m\]"
>   local COLOR2="\[\033[1;36m\]"
>   local COLOR3="\[\033[1;30m\]"
>   local COLOR4="\[\033[0m\]"
> 
> Where exactly is the color information? Is there
> a good howto somewhere?
> 
Here is something I have on my Linux system...
Adjust to taste ...

# Terminal codes for petty displays
#
#    \033          ascii ESCape
#    \033[<NUM>G   move to column <NUM> (linux console, xterm, not vt100)
#    \033[<NUM>C   move <NUM> columns forward but only upto last column
#    \033[<NUM>D   move <NUM> columns backward but only upto first column
#    \033[<NUM>A   move <NUM> rows up
#    \033[<NUM>B   move <NUM> rows down
#    \033[1m       switch bold on
#    \033[31m      switch red on
#    \033[32m      switch green on
#    \033[33m      switch yellow on
#    \033[m        switch color/bold off
#    \017          exit alternate mode (xterm, vt100, linux console)
#    \033[10m      exit alternate mode (linux console)
#    \015          carriage return (without newline)
#

esc=`echo -en "\033"`
BOLD="${esc}[1m"
RED="${esc}[31m"
GREEN="${esc}[32m"
YELLOW="${esc}[33m"
NORMAL=`echo -en "${esc}[m\017"`
                                                              1,1           Top
...have fun

Cliff



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010122053759.A1639>