You could either set all elements as ‘inactive’ by individually setting it on each element ID, but it may be easier if you set a class on all buttons, set a style for all items in that class (as inactive), then then set a color only for the button you want active after that.
there’s a function symbolElement.getElementsByClassName(className);
built for this exact thing.
Here’s a sample of how to use this to set CSS on a number of elements: Closing all popups