Rainbow appears when there's Sun & Rain.
Sun can be compared to Buddha's blessing, to happiness. Rain can be compared to tears.
While there is much to say insofar as understanding the core teachings of this technique, it can be summarized as making every thought a loving thought.
Every pleasant or unpleasant experience can be perceived as a lesson, for which one can be grateful.
The Spiritual Nature of All Things.
The method of achieving Rainbow Body is the art of embracing all of what life has to offer, including experiences that society labels as unquestionably bad or undesirable. To be sure, we need not seek out suffering, harm, or oppression, yet at the same time, we must develop a comprehension of the spiritual nature of all things.
Once one really perceives that all events and things in life are spiritual at their foundation, gratitude for being able to experience them can be developed. In this way, any experience, no matter how seemingly horrific and tragic, can be viewed or defined in a way that produces the experience of gratitude. The more one finds success in this path and the more one feels empowered by the challenges of life, the more one can embrace change and evolve in harmony with the ever-emerging newness or novelty of existence.
The Altruism of the Rainbow Body.
As one point of consideration, the Rainbow Body, as described below, is not a selfish or self-serving practice. While one does achieve increasing states of personal healing, transcendence, and empowerment, it is harmonized with an ever-increasing desire to service others and become an instrument of universal will.
Mirror-clear.
The analogy given by Dzogchen masters is that one's nature is like a mirror which reflects with complete openness but is not affected by the reflections, or like a crystal ball that takes on the color of the material on which it is placed without itself being changed. The knowledge that ensues from recognizing this mirror-like clarity / which cannot be found by searching nor identified / is what Dzogchenpas refer to as rigpa.
Source: The Rainbow Body of Light.
-=- Padmasambava's Rainbow Body / Guru Rinpoche /. -=-