App-numero2bgc

 view release on metacpan or  search on metacpan

numero2bgc  view on Meta::CPAN

    my $c ;
    if ( defined $v1 and $_ < $v1 || $v2 < $_ ) { 
      do { print ; next } if 0 eq ( $v3 // '' ) ;
      $c = $_ < $v1 ? 0 : $M - 1 ;
    }
    $c //= $n2c{$_} ;#say RED $c ;
    my $R = ceil max 0 , min 5 , $c - ($M/2-.5)  ; 
    my $G = max 0, ceil min 2 , ($M/2-.5) - abs ( ($M/2-.5) - $c )  ;
    my $B = ceil max 0 , min 5, ($M/2-.5) - $c  ;
    ($R,$B)=($B,$R) if $o{'~'} ; 
    my $color = "bold on_rgb$R$G$B" ;
    $usedC { $color }++;
    #print "$R$G$B"; 
    #print "$c-$R$G$B" .color( 'reset' ) ;
    #print "$_:$c-$R$G$B" .color( 'reset' ) ;
    #print color( $color ) . "$_:$c-$R$G$B" .color( 'reset' ) ;
    print color( "$color" ) . "$_" .color( 'reset' ) ;
  } else { 
    print $_ ;
  }
}



( run in 0.616 second using v1.01-cache-2.11-cpan-c333fce770f )