Opened 4 years ago

Last modified 3 years ago

#31216 closed Bug

Support terminal color output on WIndows via colorama — at Initial Version

Reported by: MinchinWeb Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Normal Keywords: windows, color, colorama
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

If colorama is installed (as on Windows), support colored terminal output.

There is a very old ticket (https://code.djangoproject.com/ticket/13476) discussing how to support colorized terminal output on Windows. At the time, ANSICON was chosen as a solution over colorama. However, the link provided for ANSICON (http://adoxa.hostmyway.net/ansicon/) no longer works, and, personally, I struggled to install it previously (it involved messing around with DLL's and some fairly low level Windows functionality). colorama, on the other hand, is a current Python package that provides color on Windows by converting the ANSI cods to Windows native color "codes"; on other platforms, it just passes through the ANSI codes through. colorama is also very popular: for example, it is vendored by pip (https://github.com/pypa/pip/tree/master/src/pip/_vendor).

What this change does is test to see if colorama is available, and activate color (on Windows) if it is. It is not a hard dependency or even added to the "install_requires" of setup.py. Personally, I would support adding coloram as a dependency on Windows, but I wasn't sure how much support there would be for that.

No documentation changes have been added, although I think this would be wise to mention in the installation instructions for Windows. No tests have been added either, but I'm not really sure what to test directly. If someone could point me to where to make those changes, I would be happy to.

Pull Request: https://github.com/django/django/pull/12387

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top