This is a code I found here. I can't remember the original creator, but I made some changes. It gives a ROYGBIV pattern and turning the background on gives it a black background, to see the colors better. I have now fixed the color problem :)
on *:input:#: {
if (%rainbowtexton) && (!$istok(! $chr(47),$left($1,1),32)) {
var %r1 1
var %rainbownupt 1
var %nintext $len($1-) + 1
var %rainboworder 04,07,08,09,11,12,06
while (%r1 < %nintext) {
if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,$gettok(%rainboworder,%rainbownupt,44) $+ $mid($1-,%r1,1),0) | inc %rainbownupt $iif(%rainbownupt = 7,-6,1) }
else { var %msgrbw %msgrbw $chr(32) }
inc %r1
}
say %msgrbw
haltdef
}
elseif (%rainbowtextandbackgroundon) && (!$istok(! $chr(47),$left($1,1),32)) {
var %r1 1
var %rainbownupt 1
var %nintext $len($1-) + 1
var %rainboworder 04,01.07,01.08,01.09,01.11,01.12,01.06,01
while (%r1 < %nintext) {
if ($mid($1-,%r1,1) != $chr(32)) { var %msgrbw $addtok(%msgrbw,$gettok(%rainboworder,%rainbownupt,46) $+ $mid($1-,%r1,1),0) }
else { var %msgrbw %msgrbw $+ $gettok(%rainboworder,%rainbownupt,46) $chr(32) }
inc %r1
inc %rainbownupt $iif(%rainbownupt = 7,-6,1)
}
say %msgrbw
haltdef
}
}
menu channel {
-
Rainbow
.Text On:{
unset %rainbowtextandbackgroundon
set %rainbowtexton 1
;echo -a Rainbow text turned on
}
.Text + Background On:{
unset %rainbowtexton
set %rainbowtextandbackgroundon 1
;echo -a Rainbow text and background colour turned on
}
.Colour Off:{
unset %rainbowtexton
unset %rainbowtextandbackgroundon
;echo -a Rainbow text, and Rainbow text with background colour turned off
}
-
}
Here's an easier way... it's what I use that I made.. I threw in my reverse text and reverse rainbow text.. for no reason honestly..
Alias:
nextcolor {
if ($$1 == 04) return 07
elseif ($$1 == 07) return 08
elseif ($$1 == 08) return 09
elseif ($$1 == 09) return 11
elseif ($$1 == 11) return 12
elseif ($$1 == 12) return 02
elseif ($$1 == 02) return 06
elseif ($$1 == 06) return 13
elseif ($$1 == 13) return 04
}
rainbow {
var %pos = 1, %color = 04, %result = $chr(3)
while (%pos <= $len($1-)) {
%result = %result $+ %color $+ $mid($1-,%pos,1) $+ $chr(3)
inc %pos
%color = $nextcolor(%color)
}
if ($isid) return %result
else say %result
}
rev {
var %len = $len($1-)
var %return = $null
while (%len > 0) {
var %return = %return $+ $mid($1-,%len,1) $+ $chr(32)
dec %len
}
return %return
}
Input:
menu channel,status,nicklist {
Default Output
.Rainbow
..On: set %rbow true | set %reverse false | set %rainverse false | echo 9 Rainbow text is now enabled
..Off: set %rbow false | echo 4 Rainbow text is now disabled
.Reverse
..On: set %reverse true | set %rbow false | set %rainverse false | echo 9 Reverse text is now enabled
..Off: set %reverse false | echo 4 Reverse text is now disabled
.Both
..On: set %rainverse true | set %rbow false | set %reverse false | echo 9 Both options are now enabled
..Off: set %rainverse false | echo 4 Both options are now disabled
}
on *:INPUT:#:{
if ($left($1,1) != /) {
msg $active $iif(%rbow == true,$rainbow($1-),$iif(%reverse == true,$rev($1-),$iif(%rainverse == true,$rainbow($rev($1-)),$1-)))
haltdef
}
}
Just my input.. I had to strip it down heavily due to a custom theme.. but I tested this and it worked as far as what it's intended for.. :S I know this could be shortened and what not, but it's just something I made long ago and I just haven't felt the need to shorten it. Anyways, hope this helps someone.