if ($2 == $null) {
to;
if (!$2) {
bad idea in this case. 'if (!$2)' is not the same as 'if ($2 == $null)'. if (!$2) is equivalent to:
if ($2 == 0) || ($2 == $false) || ($2 == $null)
'0' is a valid colour (although the script's description is inconsistent with the message in on LOAD) and so we wouldn't want to use 'if (!$2)' since $2 = 0 will satisfy that condition.