My default terminal color is gray, and that's fine.
My Bash prompt displays a bunch of colors, and this works fine:
PS1="${COLOR_RED}\u${COLOR_WHITE}@${COLOR_RED}${COMPUTERNAME} ${COLOR_BLUE}\w${GITPROMPT} ${COLOR_RESET}"
But the text I type in, at the end of the prompt, is gray. I want it to be white (ANSI code "[37m").
If I add a COLOR_WHITE at the end of the prompt, instead of the COLOR_RESET, then the default terminal color changes to white until it is reset. This makes a weird effect of some gray text, with some white text bleeding through at the top.
How can I change the "input text" color of the Bash prompt, to something other than the terminal default color?
Simply add the following line:
export PS1=" \[\033[34m\]\u@\h \[\033[33m\]\w\[\033[31m\]\[\033[00m\] $ "
Preview:
These are my preferred colors. You can customize each part of the prompt's color by changing m
codes (e.g., 34m
) which are ANSI color codes.
List of ANSI color codes: