added method to compute color.