1

I made some animations and a game that are to be played in the terminal and they rely on the terminal only having 8 colors available. When I run them on a Terminal that has 16 colors available (particularly obvious when you run neofetch and see the colors available) they do not render properly at all.

Is there a quick and dirty way to force a linux terminal to use only 8 colors?

Edit: The problem may also be that I was using an older version of ncurses on Ubuntu 18.04 LTS when I made these programs. I am attempting to get them to look right on a distro with an up-to-date version of the library. For anyone interested in attempting to answer the question I originally posed I'll still accept anything that demonstrates ways to force gnome-terminal to revert to 8-color mode if that's even possible.

Edit: The problem was related to my frequent use of standend() to revert the drawing functions back to white on black text. For some reason this was not doing what I expected it to do on some distros. By explictly telling it to attron() a color pair that was defined explictly as black and white I solved the problem. This is a hacky and hard-coded solution that stems from my abusing the ncurses library in a hard-coded way. Consider this solved, although I'd be interested in some digestible resources on programming with raw escape sequences for the future to better understand this problem.

  • Set TERM=xterm? – muru Nov 3 '19 at 6:38
  • 2
    more likely you're trying to use some hardcoded script, which ignores TERM (or makes silly assumptions, such as "vt100s do color"). – Thomas Dickey Nov 3 '19 at 12:04
  • 2
    Without seeing the scripts, one can only guess. The terminal description for "xterm" says the terminal only supports the standard ANSI 8 colors, but a program can ignore that, doing whatever the terminal actually supports. – Thomas Dickey Nov 3 '19 at 18:18
  • 1
    If you have a solution, please post it as an answer instead of editing the question. – muru Nov 5 '19 at 6:20
0

The problem was related to my frequent use of standend() to revert the drawing functions back to white on black text. For some reason this was not doing what I expected it to do on some distros. By explictly telling it to attron() a color pair that was defined explictly as black and white I solved the problem. This is a hacky and hard-coded solution that stems from my abusing the ncurses library in a hard-coded way.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.