Closed cswank closed 4 years ago
Yes, I'm pretty sure that specifying foreground and background at the same time is supported on major terminals. I tested a few with
printf '\033[48;5;130;38;5;40mHi\033[0m\n'
This PR should not be merged yet.
I just thought of an edge case and recovered escape_test.go that you asked me to remove and added another test case in which the background color being set is 38.
"\033[48;5;38;38;5;100mHi!!"
38 is a valid color but also the code for setting the foreground color. It causes escapeInterpreter to panic with my changes.
Would you prefer I close this PR and open another one or just ping you when I think I have this edge case fixed?
I think that latest commit fixes the edge cases I thought of.
I also realized that this only supports 8 bit colors (ei.output256()). I think outputNormal() needs the same behavior.
I'll work on that now.
It looks like OutputNormal already supports specifying foreground and background at the same time. So this should be good to go.
Thanks for making the PR
for example:
results in a foreground color (100) and a background color (200)
Since this also introduces the first test, what would you think about using testify/assert in the tests?