2
Sets up the terminal color scheme.
7
from django.utils import termcolors
11
Returns True if the running system's terminal supports color, and False
14
unsupported_platform = (sys.platform in ('win32', 'Pocket PC'))
15
# isatty is not always implemented, #6223.
16
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
17
if unsupported_platform or not is_a_tty:
22
"""Returns a Style object with the Django color scheme."""
23
if not supports_color():
27
style.ERROR = termcolors.make_style(fg='red', opts=('bold',))
28
style.ERROR_OUTPUT = termcolors.make_style(fg='red', opts=('bold',))
29
style.NOTICE = termcolors.make_style(fg='red')
30
style.SQL_FIELD = termcolors.make_style(fg='green', opts=('bold',))
31
style.SQL_COLTYPE = termcolors.make_style(fg='green')
32
style.SQL_KEYWORD = termcolors.make_style(fg='yellow')
33
style.SQL_TABLE = termcolors.make_style(opts=('bold',))
37
"""Returns a Style object that has no colors."""
39
def __getattr__(self, attr):