lcd: fix integer overflow in calculation of number of colors