#!/usr/bin/perl use strict; # Desired number of steps my $steps = 16; # RGB components of random beginning and ending colors my @beg = (int(rand(256)), int(rand(256)), int(rand(256))); my @end = (int(rand(256)), int(rand(256)), int(rand(256))); # 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 for my $i (0..$steps-1) { printf("%3d %3d %3d %3d\n", $i, $beg[0] + $i * $delta[0], $beg[1] + $i * $delta[1], $beg[2] + $i * $delta[2]); }