How can I set my prompt to be colourized in 256 colours? I am looking for an equivalent to the bash prompt:
local DEFAULT="\[\033[0;39m\]"
local ROOK="\[\033[38;5;24m\]"
PS1="${ROOK}\$${DEFAULT} "
colorszsh
How can I set my prompt to be colourized in 256 colours? I am looking for an equivalent to the bash prompt:
local DEFAULT="\[\033[0;39m\]"
local ROOK="\[\033[38;5;24m\]"
PS1="${ROOK}\$${DEFAULT} "
Best Answer
First, ensure that your terminal supports 256 colors, which I suppose you already have. Second, use a
PS1
variable with the correct code, for example:This will give you a prompt with the host name in bold, with a foreground color of 214 and a background color of 123.
Note that the
^[
is "entered" by typing Ctrl+v and Ctrl+[. See this excellent article "That 256 Color Thing" for the whole list of attributes.