Is there any library that can convert RGB colors to ANSI colors?

John Machin sjmachin at
Sun Nov 30 10:04:15 CET 2008

On Nov 30, 4:39 pm, ZelluX <zel... at> wrote:
> Convert RGB colors to the closest ANSI colors. For example, given RGB
> color FF0000, it should print [31m.

Maybe ... but you could write it yourself quickly enough; the code is
a trivial loop over a list of the RGB values of the 8 possible
colours, and would fit easily on a 24x80 terminal :-) Why don't you
have a try at it and come back if you have any problems?


More information about the Python-list mailing list