sub random_color { my ($r, $g, $b) = (int(rand(256)), int(rand(256)), int(rand(256))); my $color1 = sprintf("#%02x%02x%02x", $r, $g, $b); my $color2 = sprintf("#%02x%02x%02x", ($r + 128) % 256, ($g + 128) % 256, ($b + 128) % 256); return ($color1, $color2); }