diff options
author | makefu <root@pigstarter.de> | 2013-04-22 15:17:15 +0200 |
---|---|---|
committer | makefu <root@pigstarter.de> | 2013-04-22 15:17:15 +0200 |
commit | b88195721f6e315c6bc029a6936ba91e4733edd8 (patch) | |
tree | 6d014fc8b04381ffbe7c2bed53c6ae65c22fc7a2 /IRC/translate_colors.py | |
parent | d9dac189ff0a0322dd0a1a9ee763e809c7661e6e (diff) |
update Reaktor - add color translator
Diffstat (limited to 'IRC/translate_colors.py')
-rw-r--r-- | IRC/translate_colors.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/IRC/translate_colors.py b/IRC/translate_colors.py new file mode 100644 index 0000000..bd71661 --- /dev/null +++ b/IRC/translate_colors.py @@ -0,0 +1,31 @@ + + +COLOR_MAP = { + "\x1b[0m" : "\x0F", # reset + "\x1b[37m" : "\x0300", + "\x1b[30m" : "\x0301", + "\x1b[34m" : "\x0302", + "\x1b[32m" : "\x0303", + "\x1b[31m" : "\x0304", + "\x1b[33m" : "\x0305", + "\x1b[35m" : "\x0306", + "\x1b[33m" : "\x0307", + "\x1b[33m" : "\x0308", + "\x1b[32m" : "\x0309", + "\x1b[36m" : "\x0310", + "\x1b[36m" : "\x0311", + "\x1b[34m" : "\x0312", + "\x1b[31m" : "\x0313", + "\x1b[30m" : "\x0314", + "\x1b[37m" : "\x0315", + "\x1b[1m" : "\x02", # bold on + "\x1b[22m" : "\x02" # bold off + } +def translate_colors (line): + for color,replace in COLOR_MAP.items(): + line = line.replace(color,replace) + return line + +if __name__ == "__main__": + import sys + print (translate_colors(sys.stdin.read())) |