Reputation: 129383
I know that you can use escape sequence %{\033[0m%}
(code zero) to change the color of the prompt back to "default" color (usually, after the prompt).
But what is the "default" that is used for this?
tput setaf $COLOR
, assuming you use it to set font color different from terminal's default color?Upvotes: 1
Views: 860
Reputation: 54495
It's terminal-dependent, but with regard to existing practice, it would have to be the former:
The other suggested choice would not be correct, since tput setaf
does not set a "default color", but rather a "current color". Whether any choice of tput setaf
corresponds to the terminal's default color is (at best) terminal-specific, since there is no relevant standard one way or the other.
ECMA 48 gives terse (one line) descriptions of SGR 0
(which is what's mentioned in the question), and SGR 30-37
, 40-47
(the setaf/setab choices commonly used for terminal descriptions that tput would use).
There's another possible choice, i.e., tput op
(selecting the original color pair), which is used in several terminal descriptions to send SGR 39
and 49
. Again, this is terminal-specific and its relationship to SGR 0
is not covered by any standard. Those happen to use the same "default color" for xterm and Linux console, but (read ECMA-48) the standard does not give that level of detail regarding "default color" and the absence of "video attributes".
Further reading:
Upvotes: 2