On SourceForge you will find release 1.12 of my Python readline
module. If you don't want to hack the colors, there is no reason to
upgrade from 1.11 to 1.12. They *should* work the same.
But if you'd like to hack the iPython colors this new version makes it
possible. In your ipythonrc file add a line like:
execfile hackcolors.py
Now in hackcolors.py you can change colors and backgrounds like this:
####hackcolors.py####
import readline
# reach deep into the bowels of readline to get the color table
escape_to_color = readline.rl.console.escape_to_color
# change a color
escape_to_color['0;32'] = 0x72
del escape_to_color
del readline
#################
The two hex digits are the background and foreground color
respectively. In the example above I'm setting the color to green on a
grey background. Here is the table that is normally used to translate
colors.
escape_to_color = { '0;30': 0x0, #black
'0;31': 0x4, #red
'0;32': 0x2, #green
'0;33': 0x4+0x2, #brown?
'0;34': 0x1, #blue
'0;35': 0x1+0x4, #purple
'0;36': 0x2+0x4, #cyan
'0;37': 0x1+0x2+0x4, #grey
'1;30': 0x1+0x2+0x4, #dark gray
'1;31': 0x4+0x8, #red
'1;32': 0x2+0x8, #light green
'1;33': 0x4+0x2+0x8, #yellow
'1;34': 0x1+0x8, #light blue
'1;35': 0x1+0x4+0x8, #light purple
'1;36': 0x1+0x2+0x8, #light cyan
'1;37': 0x1+0x2+0x4+0x8, #white
'0': None,
}
An interested party should be able to arbitrarily map colors and their
backgrounds.
Enjoy,
gb
--
http://mail.python.org/mailman/listinfo/python-list