Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub colsure {
- my $type = shift ;; my %magic;
- # this used to be much more complex (weechat's fault) but now it is has been dumbed down enough to deserve a rewrite sometime soon
- return sub {
- my @colour = map { ($_ ~~ undef) ? return : $_ } @_;
- if ($type eq 'magic') {
- if (($#colour + 1) == 2) {
- return $magic{"@colour"} if $magic{"@colour"};
- $magic{"@colour"} = "".int(rand 15).",".int(rand 15);
- return $magic{"@colour"}
- }
- else {
- return $magic{"@colour"} if $magic{"@colour"};
- $magic{"@colour"} = "".int(rand 15);
- return $magic{"@colour"}
- }
- }
- elsif ($type eq 'random') {
- if (($#colour + 1) == 2) { return "".int(rand 15).",".int(rand 15) }
- else { return "".int(rand 15) }
- }
- else {
- if (($#colour + 1) == 2) { return "0$colour[0],$colour[1]" }
- else { return "$colour[0]" }
- }
- }
- }
Add Comment
Please, Sign In to add comment