Good thing I asked, because it now looks like you want something different than described in the 1st post.

The first post made it look like you wanted to physically change only your message that everyone else sees in channel, by inserting colors. That can be a problem because I've seen channel modes that simply strip colors from everyone's messages before they're sent to the channel, but other times the message containing color is completely blocked. Also, colorizing nicks for everyone else to see is not a great idea, because you can't assume others have the same background color that you do, so while 2=blue looks great against a white background, not easy to see for someone who has a black background. That problem can be solved by forcing your message to be sent containing a color code to set the background color matching your own background color, but that would be irritating for everyone else to see your message striped as a different color than everyone else's message.

The 2nd post makes it look like you just want to change the display-to-self of all messages, both yours and theirs, so that the nick is replaced by a colorized nick, and it wouldn't change your actual message that everyone else sees, it would just make it so that you see your own message having the nicks colorized. That would require hooking ON TEXT and ON ACTION events to handle everyone else's, and hooking ON INPUT to handle your own. It would also add complexity to try to preserve multiple consecutive spaces in how you see messages, because of how /echo displays text with having leading/trailing/consecutive spaces missing.

Also, how do you want to handle messages where someone has already inserted color codes in the text? If there's a message where someone has the text be normal color, then has the color code to make the text red, then more text, then users someone's nick, then has more text. It would be extremely difficult to have the text color return back to red, because there's no identifier to inform what the color is at a specific position within the text. Also, even if there were, you don't always see the color as that color, because changing the text to a different color following the use of Ctrl+R to make the text be reverse - the text doesn't appear in that new color until you toggle Ctrl+R off again.

Here's a first attempt to change the way a string appears when you echo it, by looking for strings containing the valid characters of a nick, then replaces them with the colorized version. You would paste these aliases into any remote script, and then you can try them out by pasting this command including the double // slash but first editing it to contain text that contains actual nicks and text that isn't a real nick in that channel. But don't change the | pipe or anything following it. Let me know if this does what you want, or give examples where it doesn't do things correctly. I have it strip out color codes, then hunt for a nick. It shouldn't find User2 within LUser2, and should handler User2 and User22 correctly, and if the nick is actually User2 it will use whatever you actually type like UsEr2 or user2. If it finds no match, it echoes the original string, otherwise it returns the string that first has the colors stripped before replacing just-the-nick.

Pasting in editbox:

//tokenize 32 test $+($chr(3),04) test User1,User2,NoSuchNick,User3 test | echo -a $replace_nick_with_colors( $1-)

After pasting these into a script in the remotes tab:

Code
alias color_the_nick {
  if ($nick($chan,$1) && ($1 !isnum)) { bset &color_the_nick 1 1 | return $+($chr(3),$nick($chan,$1).color,$1,$chr(3)) }
  return $1
}

alias replace_nick_with_colors {
  bunset &color_the_nick
  var %a $regsubex(foo,$strip($1-,c),/([a-zA-Z0-9_\\\]\[{}|^-]+)/g,$color_the_nick(\t))
  if (!$bvar(&color_the_nick,0)) return $1-
  return %a
}