How can this Math.floor() solution only fail for the colour red?