From d3e237811c98423683b711742450ded747ecfe3f Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 24 May 2020 22:37:34 +0200 Subject: Add a check for terminals not supporting 256 colors --- poezio/core/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/poezio/core/core.py b/poezio/core/core.py index 973c9103..3ad15719 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -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' -- cgit v1.2.3 From 66cd8e54b05aab10bc8eafae77fdbb4e30fed45b Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 24 May 2020 22:38:11 +0200 Subject: Do not degrade colors for terminals supporting more than 256 --- poezio/theming.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poezio/theming.py b/poezio/theming.py index fc34ae39..6f1d8226 100755 --- a/poezio/theming.py +++ b/poezio/theming.py @@ -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])) -- cgit v1.2.3