X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=videosite.git;a=blobdiff_plain;f=videosite-irssi.pl;h=3d72728623fa91d787d6d972f944297f547ba9f4;hp=3ab54ecf5c67b3f1d45f3046c47415ff14daca13;hb=a5c45c2f569d05a7107e48fa095723c7e62bbc47;hpb=89e8775f8f880bd14731e4501d13a3d63fe5fcb5 diff --git a/videosite-irssi.pl b/videosite-irssi.pl index 3ab54ec..3d72728 100644 --- a/videosite-irssi.pl +++ b/videosite-irssi.pl @@ -11,6 +11,21 @@ use XML::Simple; 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: @@ -162,12 +177,15 @@ sub config_del { # # Return a color code. Called by the core # +# Does not handle background colors yet. +# 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; } #