Rainbows are often seen after a rainstorm when the sun shines through the clouds. Therefore it is generally associated with positive things like peace and joy. It is quite colourful too. In the context of the poem, we can conclude that the rainbow signifies the happy and joyous state of the narrator's heart.