How do I use color palettes on materials for sprites?

I want the player to be able to change the color of the part of the sprite using a color palette, how do I do this?