since my software outputs colors in the console, I searched for
an ANSI Escape Sequence which “resets” the color(s) to the pre-
last state; so if I set a color (A), then use a color (B), then
I wanted to go back to color (A) by some color reset sequence.
I found the “[38m” and “[48m” to reset back to the default colors,
but this only holds for the one which is default in the terminal.
So, now I’ve got some code to do this, no prob. But I’m wondering
if I should override the existing “[38m” and “[48m”, or if you’d
recommend me to use my own code?
What’d you say? Any suggestions, also for the code to use?
Greetz; the Cake.
It all works great, but I fear the use of regular “[38m” and “[48m”
would override really necessary sequences which someone would like
to use nevertheless.
BTW: No need for a color stack, right? Atm I’m using just two states
for each {foreground,background}, but I could also use an Array as
some stack, to carry any previously used color(s). No need for, right?
Sebastian Kucharczyk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
6