Convert 24-bit codes to the nearest 256-colour code