in reply to show your colours!

shmem++! :-)

For a different color projection of the same data, try my SIOB css.

It distributes the bits across all three colors equitably. Older monks will have darker backgrounds and newer monks lighter.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^2: show your colours!
by shmem (Chancellor) on Jan 28, 2007 at 12:58 UTC
    It distributes the bits across all three colors equitably.

    mind to share your algorithm?

    Older monks will have darker backgrounds and newer monks lighter.

    This one has to be discussed. Isn't age about grey beards first, and then white hair? See merl^WGandalf.

    I've made up another css, in which red, green and blue are derived from monks rank, sorting them via XP, time at the monastery and number of writeups. If you have a light setting (e.g. background white, foreground black), then the colour for monks below sainthood will be nearly indistinguishable from merlyn the white, so there's the reverse css also.

    Here's the script to produce them:

    #!/usr/bin/perl use strict; use Time::Local; use LWP::Simple; my $content = get("http://perlmonks.org/?node_id=3559;displaytype=raw" +); my ($maxLVL,$maxtime,$maxwrt,$now,%monk); my @lvls = (0..12,30,40,54,70,90,120,160,220,300,400,500,600,700,800,9 +00,1000); my %time = ( sec => 1, hour => 3600, day => 86400, week => 86400*7, year => 86400*365, ); $now = time; for(split /\r?\n/,$content) { next unless /<tr/; next if /Experience/; next if /weeks|month|year/; # skip those my ($id,$monk,$XP,$lvl,$writeups,$since,$last_here) = m!<tr[^>]*><td[^>]*>\d+</td><td><span class="user-(\d+)"><a[^>]+>( +[^<]+)</a></span></td><td[^>]*>(\d+)</td><td>\w+ \((\d+)\)</td><td[^> +]*><a[^>]+>(\w+)</a></td><td[^>]*>([^<]+)</td><td[^>]*>([^>]+)</td></ +tr>!; $writeups = 0 if $writeups =~ /None/; my @l = reverse split /-/,$since; $l[1]--; $since = timelocal(0,0,0,@l); @l = split/\s+/,$last_here; $l[1] =~ s/s$//; $last_here = $now - $l[0] * $time{$l[1]}; my $monktime = $last_here - $since; $monk{$id} = [ $XP, $writeups, $monktime # to sort for "longest time here" ]; } foreach my $n (0..2) { my $c=0; # swap $a and $b for reverse sorting, i.e. for "dark vroom" $monk{$_}->[$n+3] = $c++ for sort {$monk{$a}->[$n]<=>$monk{$b}->[$ +n]} keys %monk; } my $m = scalar keys %monk; foreach my $id(sort {$monk{$b}->[1]<=>$monk{$a}->[1]}keys %monk) { my ($x,$w,$t) = map { int($monk{$id}->[$_] / $m * 256) } 3,4,5; for($x,$w,$t) { $_ = 255 if $_ > 255 } my($r,$g,$b) = ($x,$w,$t); # change here to say e.g. + XP => green my $col = sprintf"#%02x%02x%02x",$r,$g,$b; $col .= "; color: white" if (3*$r + 2*$g + 1*$b )/6 < 128; print "*[class\$=\"$id\"], *[class\$=\"$id\"] *, *[class\$=\"$id\" +] *:link, *[class\$=\"$id\"] *:visited { background: $col; }\n"; }

    (Yeah, I'm parsing HTML with a regular expression, but that's because it's me, don't you dare to do that! ;-)

    With that CSS, the "virtues" of each saint can be seen by color, e.g. those lacking green posted little (in number, that is. See e.g. Erudil :-)

    If anbody finds a way to shorten the resulting insanely long CSS file (62kB), or finds a way how to say those damned browser how to cache a CSS, please reply to this post. Thank you.

    <update>

    A significant cut in size would be achieved if the coloured css was generated on the fly, calculating color settings only for those tags used in a served page. That would need 2 more fields (foreground/background) on Display Settings.

    </update>

    <update>

    Both css files reference monkpref.css which holds individual personal preferences, overrides the defaults for those and can be included on its own.

    CSS files are rebuilt every hour. I've reduced the size of the css files by skipping monks which haven't been here for more than a week. More contrast for active monks :-) </update>

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}