Hi,

Do you have to select or can you generate?

My idea is use the color picker tool to pick the 5 colors from the image you like, and then generate the colors inbetween, with total amount of steps that adds up to 256,

like this "black body" colormap used is for photoshop fire effect

code

sub BlackBody { ColormapHtml( BlackBodyMap() ); ColormapHtml( GreyscaleMap() ); } sub ColormapHtml { my $blackbody = shift; print "<table>"; while(@$blackbody){ print "<tr>"; #~ for(1..8){ #~ for(1..16){ for(1..32){ my $color = shift @$blackbody; #~ my $hex = join '', map { pack 'H*', $_ } @$color; my $hex = rgb2hex( @$color ); #~ print qq[<td bgcolor="#$hex"><font color="#$hex">$hex</ +font></td>]; print qq[<td bgcolor="#$hex"><font color="#$hex">_</font>< +/td>]; } print "</tr>"; } print "</table>"; } sub rgb2hex { #~ my( $r, $g, $b ) = @_; sprintf '%02x%02x%02x', @_; } sub BlackBodyMap { my $one = [ 255, 0, 0 ] ; my $two = [ 255, 255, 0 ]; my @colormap = ( YuckFoo( 85, [0,0,0] => $one ), YuckFoo( 85, $one => $two ), YuckFoo( 86, $two => [255,255,255] ), ); return \@colormap; } sub GreyscaleMap { return [ YuckFoo(256, [0,0,0] => [255,255,255] ) ]; } sub YuckFoo { my( $steps, $beg, $end) = @_; # RGB rate of change from beginning to ending color my @delta = ( ($$end[0] - $$beg[0]) / ($steps-1), ($$end[1] - $$beg[1]) / ($steps-1), ($$end[2] - $$beg[2]) / ($steps-1), ); # Calculate colors using beginning color and rate of change my $i = 0; my @gradient; while($i < $steps) { my $color = [ $$beg[0] + $i * $delta[0], $$beg[1] + $i * $delta[1], $$beg[2] + $i * $delta[2] ]; push @gradient, $color; $i++; } return @gradient; }
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________
________________________________

In reply to Re: A data selection problem(in3D). by Anonymous Monk
in thread A data selection problem(in3D). by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.