Use $cnick($nick) - it will return 0 if the nick isn't in the alt-b > colors list.

Code:
if ($cnick($nick)) { dostuff }