From the Super Mario Wiki
A Treasure Button is an item 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, Light Green, Dark Green, Light Blue, Dark Blue, Purple, and Pink.
When Wario finds that treasure, the treasure spot and the button turn gray.