optional rect argument for replace color method