Dynamic Material Instance

you can search and use flipflop node on your case.(the select color node need to have selectA boolean turn on or off)