From the Super Mario Wiki
A Treasure Button is an object found in Wario World. Ground Pounding, punching or throwing an enemy at the button will make a treasure chest containing one of Wario's Treasures appear on a panel of the same color somewhere else in the level.
In each level, there are eight differently colored Treasure Buttons: red, yellow, chartreuse, green, cyan, blue, purple, and pink.
When Wario finds that treasure, the treasure spot and the button turn gray.