Jelajahi Sumber

ColorScheme 'none' will generate the color gradient again, the gradient is dropped with HiCell="".

Christoph Berg 21 tahun lalu
induk
melakukan
210e715f6c
4 mengubah file dengan 15 tambahan dan 11 penghapusan
  1. 3 0
      docs/Changelog
  2. 6 2
      docs/pisg-doc.xml
  3. 2 2
      modules/Pisg.pm
  4. 4 7
      modules/Pisg/HTMLGenerator.pm

+ 3 - 0
docs/Changelog

@@ -1,4 +1,7 @@
 pisg (0.68) - ??
+   Christoph:
+     + ColorScheme 'none' will generate the color gradient again, the gradient
+       is dropped with HiCell="".
    Torbjörn:
      + Generate stats in multiple languages in a single run.
 

+ 6 - 2
docs/pisg-doc.xml

@@ -751,7 +751,7 @@
     name or URL (i.e. a color scheme name with .css or a path), the file will
     be linked to instead. Using "none" will cause pisg to write only the body
     of the page; use this to include the statistics into a custom page. See
-    also <xref linkend="CssDir" />,
+    also <xref linkend="CssDir" />, <xref linkend="AltColorScheme" />,
     <link linkend="HiCell">HiCell/HiCell2</link>.
     </para>
     </refsect1>
@@ -3756,6 +3756,7 @@
     <refsynopsisdiv><programlisting>
       <![CDATA[
         <set HiCell="#BABADD" HiCell2="#CCCCCC">
+        <set HiCell="">
       ]]>
     </programlisting></refsynopsisdiv>
 
@@ -3764,7 +3765,10 @@
     <para>
     <command>HiCell</command> and <command>HiCell2</command> define the colors
     to be used for the color gradient in the most active nicks section. They should
-    match your <xref linkend="ColorScheme" />.
+    match your <xref linkend="ColorScheme" />. When setting
+    <command>HiCell</command> the empty string (""), pisg will not generate a color
+    gradient; you might want to use this with <xref linkend="ColorScheme" />="none"
+    or <xref linkend="AltColorScheme" />.
     </para>
     </refsect1>
     <refsect1>

+ 2 - 2
modules/Pisg.pm

@@ -363,7 +363,7 @@ sub init_config
             my ($channel, $settings, $tmp) = ($2, $3, {});
             $tmp->{$channel}->{channel} = $channel;
             $self->{cfg}->{chan_done}{$self->{cfg}->{channel}} = 1; # don't parse channel in $self->{cfg}->{channel} if a channel statement is present
-            while ($settings =~ s/\s([^=]+)=(["'])(.+?)\2//) {
+            while ($settings =~ s/\s([^=]+)=(["'])(.*?)\2//) {
                 my $var = lc($1);
                 my $val = $3;
                 if ($var eq "logdir" || $var eq "logfile") {
@@ -380,7 +380,7 @@ sub init_config
                     push @{ $self->{chans} }, $tmp;
                     last;
                 }
-                if ($_ =~ /^\s*(\w+)\s*=\s*(["'])(.+?)\2/) {
+                if ($_ =~ /^\s*(\w+)\s*=\s*(["'])(.*?)\2/) {
                     my $var = lc($1);
                     my $val = $3;
                     unless ((($var eq "logdir" || $var eq "logfile") && scalar(@{$self->{override_cfg}->{$var}}) > 0) || (($var ne "logdir" && $var ne "logfile") && $self->{override_cfg}->{$var})) {

+ 4 - 7
modules/Pisg/HTMLGenerator.pm

@@ -563,10 +563,7 @@ sub _activenicks
             $visiblenick = $self->_format_word($nick);
         }
 
-        my $style = '';
-        if ($self->{cfg}->{colorscheme} ne 'none') {
-            $style = "style=\"background-color: ". $self->generate_colors($c) ."\"";
-        }
+        my $style = $self->generate_colors($c);
 
         my $class = 'rankc';
         if ($c == 1) {
@@ -685,10 +682,10 @@ sub generate_colors
     my $self = shift;
     my $c = shift;
 
-    my $h = $self->{cfg}->{hicell};
+    my $h = $self->{cfg}->{hicell} or return "class=\"hicell\"";
     $h =~ s/^#//;
     $h = hex $h;
-    my $h2 = $self->{cfg}->{hicell2};
+    my $h2 = $self->{cfg}->{hicell2} or return "class=\"hicell\"";
     $h2 =~ s/^#//;
     $h2 = hex $h2;
     my $f_b = $h & 0xff;
@@ -701,7 +698,7 @@ sub generate_colors
     my $green  = sprintf "%0.2x", abs int(((($t_g - $f_g) / $self->{cfg}->{activenicks}) * +$c) + $f_g);
     my $red  = sprintf "%0.2x", abs int(((($t_r - $f_r) / $self->{cfg}->{activenicks}) * +$c) + $f_r);
 
-    return "#$red$green$blue";
+    return "style=\"background-color: #$red$green$blue\"";
 }
 
 sub _html