Move palette generation to common utils