I started a project on Ubuntu using Python curses library. All worked great, I used some colors, so its fancy, everything is A-OK. Then I wanted to run the script on Windows. Although the script runs just as it should on Linux, the main problem are the colors - or lack of them.
It's not that my console is not supporting them - curses.has_colors()
returns True, curses.COLORS
is 256
, but the colors... are looking like a strange encoded escape characters.
Here's a sample of my test code:
win = curses.initscr()
if curses.has_colors():
curses.start_color()
curses.use_default_colors()
for i in range(curses.COLORS - 1):
curses.init_pair(i + 1, i , -1)
win.addstr(str(i), curses.color_pair(i + 1))
win.getch()
And here's what's printed to console: terminal colors
What am I doing wrong? I tried this on Windows Powershell, same result. Internet is telling me that it should work, but its not. Somebody help me? I'm using Windows 10 Pro.