(stream)
| 4 | |
| 5 | |
| 6 | def has_colours(stream): |
| 7 | if not (hasattr(stream, "isatty") and stream.isatty): |
| 8 | return False |
| 9 | try: |
| 10 | import curses |
| 11 | curses.setupterm() |
| 12 | return curses.tigetnum("colors") > 2 |
| 13 | except: |
| 14 | return False |
| 15 | |
| 16 | |
| 17 | has_colours = has_colours(sys.stdout) |