Some themes have this functionality baked into their theme code. Otherwise, you can use an app such as Variant Options Swatch King to implement this functionality on your existing store. Feel free to see their app in action here. They offer a 30-day free trial before selecting a paid plan.
If there is anything else I can help you with, please let me know.
The third-party theme developers at Out of The Sandbox have some great themes that have this sort of functionality built-in. Worth checking out.