I am using the termcolor library with python3 to output colored text in my terminal.
I have a few issues though. It seems to overwrite more global settings, as words on which I do not use termcolor have their color changed too.
Better to look at the image: Image
In all the lines, I only use termcolor to color the last column. The beginning of the first line till the previous to last column looks like a standard line in my terminal (konsole). The last column should be red, but somehow is orangish-red... The 2nd row is fully colored changed, yet I only applied it to the last column... (which this time is red, as wanted). The 3rd row is the same as the 2nd, minus the fact that the last one should be yellow but is orange instead.
If I run my script in xterm instead of Konsole, the output is exactly what I would like, but again it changes the color (/ highlight?) of some text I did not ask it for. (The output of the script looks indeed like what I'd want, but the original xterm colors are not to my liking and somehow termcolor changed them all again like with Konsole, although the end is more pleasing it is still not the desired behavior)
Is this something to configure in my python script? Or in my terminal?
Here is a code sample:
if col1 == "?":
coloredCol = colored(col2, "yellow")
elif col2 > 1:
coloredCol = colored(col2, 'green')
elif col2 < 1:
coloredCol = colored(col2, 'red')
else:
coloredCol = colored(col2, 'white')
print (col1, col3, col4, col5, col6, coloredCol)
col1, col3, col4, col5, col6 are just "simple" "non-termcolored" variables.
Thank you!