Merge branch 'check-colors-startup' into 'master'

Check colors on startup and warn

See merge request poezio/poezio!120
This commit is contained in:
Link Mauve 2020-05-24 22:43:50 +02:00
commit 0ddcde70c8
2 changed files with 7 additions and 1 deletions

View file

@ -543,6 +543,12 @@ class Core:
default_tab.on_gain_focus()
self.tabs.append(default_tab)
self.information('Welcome to poezio!', 'Info')
if curses.COLORS < 256:
self.information(
'Your terminal does not appear to support 256 colors, the UI'
' colors will probably be ugly',
'Error',
)
if firstrun:
self.information(
'It seems that it is the first time you start poezio.\n'

View file

@ -448,7 +448,7 @@ def to_curses_attr(
colors = color_tuple
bold = False
if curses.COLORS != 256:
if curses.COLORS < 256:
# We are not in a term supporting 256 colors, so we convert
# colors to numbers between -1 and 8
colors = (color_256_to_16(colors[0]), color_256_to_16(colors[1]))