PS Question: Using a Pallet to change color

Hey guys I’m making some textures for a map I’ve created for a game called Tanarus. The game only recognizes certain colors that are in this pallet

I know there is a way to somhow insert the pallet into the coloring scheme and have it change your image to these colors only. Any help would be appreciated. Thanks,

Nuvis