First pass at pallete based colour mating. still buggy.