From 24073ca628342d2c99369117197791602c60e415 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Mon, 18 Dec 2017 10:10:15 -0500 Subject: Return 0 from 'number_of_colors' when does_styling is False --- blessings/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/blessings/__init__.py b/blessings/__init__.py index a2254b1..810d367 100644 --- a/blessings/__init__.py +++ b/blessings/__init__.py @@ -337,6 +337,9 @@ class Terminal(object): # don't name it after the underlying capability, because we deviate # slightly from its behavior, and we might someday wish to give direct # access to it. + if not self._does_styling: + return 0 + colors = tigetnum('colors') # Returns -1 if no color support, -2 if no # such cap. # self.__dict__['colors'] = ret # Cache it. It's not changing. -- cgit v1.2.1