ansirc 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ansirc.rb +21 -19
- metadata +1 -1
data/lib/ansirc.rb
CHANGED
@@ -6,32 +6,34 @@
|
|
6
6
|
|
7
7
|
class ANSIRC
|
8
8
|
COLOR_MAP = {
|
9
|
-
"\033[0m" =>
|
10
|
-
"\033[1;37m" =>
|
11
|
-
"\033[0;30m" =>
|
12
|
-
"\033[0;34m" =>
|
13
|
-
"\033[0;32m" =>
|
14
|
-
"\033[0;31m" =>
|
15
|
-
"\033[0;33m" =>
|
16
|
-
"\033[0;35m" =>
|
17
|
-
"\033[0;33m" =>
|
18
|
-
"\033[1;33m" =>
|
19
|
-
"\033[1;32m" =>
|
20
|
-
"\033[0;36m" =>
|
21
|
-
"\033[1;36m" =>
|
22
|
-
"\033[1;34m" =>
|
23
|
-
"\033[1;31m" =>
|
24
|
-
"\033[1;30m" =>
|
25
|
-
"\033[0;37m" =>
|
9
|
+
"\033[0m" => "\0xF", # reset
|
10
|
+
"\033[1;37m" => "\0030",
|
11
|
+
"\033[0;30m" => "\0031",
|
12
|
+
"\033[0;34m" => "\0032",
|
13
|
+
"\033[0;32m" => "\0033",
|
14
|
+
"\033[0;31m" => "\0034",
|
15
|
+
"\033[0;33m" => "\0035",
|
16
|
+
"\033[0;35m" => "\0036",
|
17
|
+
"\033[0;33m" => "\0037",
|
18
|
+
"\033[1;33m" => "\0038",
|
19
|
+
"\033[1;32m" => "\0039",
|
20
|
+
"\033[0;36m" => "\00310",
|
21
|
+
"\033[1;36m" => "\00311",
|
22
|
+
"\033[1;34m" => "\00312",
|
23
|
+
"\033[1;31m" => "\00313",
|
24
|
+
"\033[1;30m" => "\00314",
|
25
|
+
"\033[0;37m" => "\00315",
|
26
|
+
"\033[1m" => "\002", # bold on
|
27
|
+
"\033[22m" => "\002", # bold off
|
26
28
|
}
|
27
29
|
|
28
30
|
def self.to_irc(text)
|
29
|
-
COLOR_MAP.each { |ansi, irc| text.gsub!(ansi,
|
31
|
+
COLOR_MAP.each { |ansi, irc| text.gsub!(ansi, irc) }
|
30
32
|
text
|
31
33
|
end
|
32
34
|
|
33
35
|
def self.to_ansi(text)
|
34
|
-
COLOR_MAP.each { |ansi, irc| text.gsub!(
|
36
|
+
COLOR_MAP.each { |ansi, irc| text.gsub!(irc, ansi) }
|
35
37
|
text
|
36
38
|
end
|
37
39
|
end
|