From the Super Mario Wiki, the Mario encyclopedia
The objective of the game is to use the stylus to rub the rainbow to let the droplets fall in to the bucket. As it begins to fill, the bucket gets up and start to move around. Any missed droplets stack up, and they can eventually get tall enough to tip over the bucket. If that happens, the player fails the microgame. At the same time, if the player takes too long to fill up the bucket, the screen eventually turns very dark, which also fails the microgame. The player wins by filling up the bucket with enough droplets.
Names in other languages