git://git.camperquake.de
/
videosite.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
89e8775
)
videosite-irssi: Implement basic color handling
author
Ralf Ertzinger
<ralf@skytale.net>
Tue, 30 Apr 2013 17:22:39 +0000
(19:22 +0200)
committer
Ralf Ertzinger
<ralf@skytale.net>
Tue, 30 Apr 2013 17:22:39 +0000
(19:22 +0200)
videosite-irssi.pl
patch
|
blob
|
history
diff --git
a/videosite-irssi.pl
b/videosite-irssi.pl
index
3ab54ec
..
3d72728
100644
(file)
--- a/
videosite-irssi.pl
+++ b/
videosite-irssi.pl
@@
-11,6
+11,21
@@
use XML::Simple;
use JSON -support_by_pp;
#
use JSON -support_by_pp;
#
+# List of foreground colors. This list is not complete, it just
+# contains the colors needed by videosite.
+#
+# The % are doubled because these are used in sprintf.
+#
+my %foreground_colors = (
+ 'magenta' => '%%m',
+ '*magenta' => '%%M',
+ '*yellow' => '%%Y',
+ '*green' => '%%G',
+ '*red' => '%%R',
+ 'default' => '%%n',
+);
+
+#
# Initialize the config subsystem. Called by the core.
#
# Due to historic reasons this has to deal with a number of possible config sources:
# Initialize the config subsystem. Called by the core.
#
# Due to historic reasons this has to deal with a number of possible config sources:
@@
-162,12
+177,15
@@
sub config_del {
#
# Return a color code. Called by the core
#
#
# Return a color code. Called by the core
#
+# Does not handle background colors yet.
+#
sub colorpair {
my ($fg, $bg) = @_;
sub colorpair {
my ($fg, $bg) = @_;
- Irssi::print(sprintf("Asked to convert (%s,%s) into irssi color codes", $fg, $bg));
+ $fg = exists($foreground_colors{$fg})?$foreground_colors{$fg}:'';
+ $bg = '';
- return
''
;
+ return
$fg . $bg
;
}
#
}
#