Yes, it called pixel indexing,
pixel indexing is an old technology, I don't know how many programs support it, but Gimp does, you can take you art, convert it to a color pallet, but you may have to re organize the pixel order.
or you can plan out the order of the color pallet and tell gimp to use a pre made pallet, and when you want to change colors you just switch between pre made color pallets. I am unsure of what game engines support dynamic color pallet swapping if you want to use it for games however.