Changing theme color

I am making an app that you can select a colour. When you select the colour I need whole theme to change colour. So something like onClick > changecolor = red.

What is the best have to change the whole theme colour in Ionic?

Thanks