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

François Pinard pinard at iro.umontreal.ca
Mon May 20 22:53:47 EDT 2002


[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 :-).

> [...] and of sometimes you have a black background instead of white, so
> some control of the colors may be needed just to get a readable display.

So true! :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list