Colorize the output to make it easier to see correct/incorrect answers
Bug #1810595 reported by
François Marier
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canadian Ham Exam |
Fix Released
|
Wishlist
|
François Marier |
Bug Description
In order to make it easier to see whether an answer was correct or incorrect, we should print the following in green:
Correct!
and the following in red:
The correct answer was (...)
Ideally, we should detect whether or not the terminal supports colors before using any.
As an alternative to using colors, we could use *bold* for correct answers and *reverse video* for incorrect ones.
Changed in canadian-ham-exam: | |
status: | Confirmed → Fix Committed |
assignee: | nobody → François Marier (fmarier) |
milestone: | none → 0.2.0 |
Changed in canadian-ham-exam: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
A number of third-party Python modules are mentioned on https:/ /stackoverflow. com/questions/ 287871/ print-in- terminal- with-colors but it's also easy to do on most platforms without any external dependencies by using ANSI escape codes:
https:/ /en.wikipedia. org/wiki/ ANSI_escape_ code
Auto-detecting support for ANSI colors is pretty hard:
https:/ /stackoverflow. com/questions/ 7445658/ how-to- detect- if-the- console- does-support- ansi-escape- codes-in- python
and so it may not be worth it.