summaryrefslogtreecommitdiffstats
path: root/Reaktor/IRC/translate_colors.py
diff options
context:
space:
mode:
authorYour Name <you@example.com>2013-05-03 23:44:58 +0200
committerYour Name <you@example.com>2013-05-03 23:44:58 +0200
commitbdc1e03a956e560ab3373436bc54d119efeb5086 (patch)
treec476636a62950a9303d3d55ae9f903a3584dc940 /Reaktor/IRC/translate_colors.py
parentab9954b0418e7473debd7fd311ed0c86bd599d59 (diff)
parentbb2c3ab8682316583e6866200678494965f81719 (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'Reaktor/IRC/translate_colors.py')
-rw-r--r--Reaktor/IRC/translate_colors.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/Reaktor/IRC/translate_colors.py b/Reaktor/IRC/translate_colors.py
new file mode 100644
index 00000000..bd716618
--- /dev/null
+++ b/Reaktor/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()))