ANSI colored output: How to determine how python was called?

Donn Cave donn at drizzle.com
Tue May 21 01:56:51 EDT 2002


Quoth pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard):
| [Donn Cave]
|
|> Quoth pinard at iro.umontreal.ca (=?iso-8859-1?q?Fran=E7ois?= Pinard):
|> ...
|> | The normal way to check for colour terminal support is through terminal
|> | info capabilities (terminfo).  [...]
|
|> That is indeed the only bona fide declaration of color capabilities,
|> but it's good for only a small subset of the color capable terminal
|> emulations.  If they're coming in as "vt102", it won't help.
|
| If a terminal declaration is improper, it is likely to be suboptimal.
| A terminal emulator should ideally have its own, adequate terminfo entry.
|
|> [...] but then lynx and other color aware applications will do really
|> horrible things with them, distasteful and unreadable.
|
| When such things happen, either the terminfo description is improper, or
| the application has bugs with terminal handling.  One should either correct
| the terminfo description, or debug the program.  We probably agree on the
| fact these areas are not that much fun, and diagnosing terminfo-related
| problems require patience, study, and some dedication :-).

I think if you saw what I've seen, we'd agree on more.

Within the limitations of ANSI terminal emulation color, the only
reliably satisfactory approach is to put the entire color scheme
under the control of the user.  At this point, you don't need any
special information from terminfo (of course it's good to check.)
If you have a fairly recent version of Pine, that's an example.

Aside from terminfo inaccuracies and application bugs, there are
also bugs and misfeatures in terminal emulators, especially when
you get into interesting combinations with the less commonly used 
background color options.

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list