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 in a different part of 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.