Setting colours of text terminals

Nemo - earth native nemo at
Fri Mar 14 17:23:29 EST 2003

On Fri, Mar 14, 2003 at 05:01:49PM +1100, Alex Satrapa did utter:
>     PS1=`echo -n "%{\\e[33m%}[%n@%m: %~]\r%B%T [%?|%!]%#%b%{\\e[0m%} "`
> Note that I use echo, since zsh only accepts certain "escaped" 
> characters (eg: %T) in the context of a command line, not a variable 
> assignment.

erm, I've never had to use echo:                                                

PS1=$'%(?.%{\e[0;36m%}.%{\e[1;31m%}%?)^ %{\e[0m%}%m%4(~.%{\e[0;34m%}.%{\e[0m%}):%{\e[0;34m%}%3~ %{\e[0;32m%}%(!.#.$) %{\e[0m%}'

RPS1=$' $(loadavg=`cut -f1 -d" " /proc/loadavg`;([[ $loadavg -lt 0.3 ]] && print "%{\e[0m%}") || ([[ ($loadavg -ge 0.3) && ($loadavg -lt 0.6) ]] && print "%{\e[1m%}") || ([[ ($loadavg -ge 0.6) && ($loadavg -lt 1.0) ]] && print "%{\e[1;33m%}") || print "%{\e[1;31m%}")< %T %{\e[0;33m%}%l%{\e[0m%}'

Back to the original question... colour in terminals? ... is honestly
something I've not thought about in years. I didn't know any terminals
*didn't* support colour out of the box. Convincing your textmode
application (be it the shell, or other) to use colours is usually
fairly trivial too. (probably less trivial for a shell, as the parody
of linenoise that is my $PS1 and $RPS1 reveal... ;)
  ------------------------------------------ --------------------------
                                                    earth native

More information about the linux mailing list