Can you clarify what you're wanting? Are you wanting something that hunts through everything you type looking for nicks, even if they're being touched by things like a comma, period, questionmark, etc? Or are you wanting an alias that looks only at the final word to see if that's a nick in that channel?
You can obtain the color of a nick by doing:
//echo -a $nick($chan, nickname).color
If you're putting this number immediately before a nick, then you don't need to worry about single-digit colors causing the 1st number of a text string to become swallowed as part of the color instead of being displayed.