Changed assert to raise ValueError in to_rgb