jifunks / botany

command line virtual plant buddy
ISC License
438 stars 32 forks source link

botany crashes if terminal doesn't support colours #7

Closed jmdejong closed 6 years ago

jmdejong commented 6 years ago

It crashes on startup on terminals that don't support colours. This corrupts the save file, making it crash all the next times too.

To reproduce, run:

TERM=vt100 ./botany.py

It is possible to detect whether the terminal supports colours by checking curses.COLORS. This is the number of colours supported. If no colours are supported it is 0.

EDIT: curses.COLORS doesn't seem to work, but using curses.has_colors() does.