This page has a pretty good explanation, although the syntax is slightly different in csh . Here is what I came up with:
set prompt="%{\e[32;1m%}%n%{\e[37m%}@%{\e[33m%}%m%{\e[37m%}:%{\e[36m%}%~%{\e[37m%}"\$"%{\e[0m%} " # root variation: set prompt="%{\e[31;1m%}root%{\e[37m%}@%{\e[33m%}%m%{\e[37m%}:%{\e[36m%}%/%{\e[37m%}#%{\e[0m%} "
update: the previous hint that I had was not actually updated when you changed directories. using %n , %~ and %m instead of $cwd or pwd actually upgrade. look here .
%{ ... %} means that the material between them must take a width of 0
\e[ ... m defines colors and bold. \e avoids [ which seems necessary (I believe this is equivalent to \033 ), m means end.
Use 0 as the color to restore the default settings.
If you want to set the color and background, just separate the numbers with a semicolon. Use 1 to enable bold.
Refer to this table to select colors:

(source: funtoo.org )
So, for example, "Hello World", in bold, blue on a red background will be %{\e[36;41;1m%}Hello World%{\e[0m%}
source share