MD5 could be used as a hash function here on the IP-string (or any string as a matter of fact), and the first 3 pairs of hex-characters could be used as rgb values:
#!/usr/bin/perl -l
use strict;
use Digest::MD5 qw(md5_hex);
my $ip="192.168.7.1";
my $ip2="192.168.7.2";
my $ip3="192.168.7.3";
my $ip4="192.168.7.4";
print join(",", ip2color($ip));
print join(",", ip2color($ip2));
print join(",", ip2color($ip3));
print join(",", ip2color($ip4));
sub ip2color {
my ($ip) = @_;
my $md5 = md5_hex($ip);
my @rgb;
foreach (0 .. 2) {
my $value_in_hex = substr($md5,0+2*$_,2);
push @rgb, hex($value_in_hex);
}
return @rgb;
}
__DATA__
251,180,114
35,50,113
80,124,60
221,201,172
Not meaningful for the eye these colors (like Zaxo's solution), but neighboring IPs very likely will have different colors.