In Dzogchen
The rainbow body phenomenon is a third person perspective of someone else attaining complete knowledge (rigpa). Knowledge is the absence of delusion regarding the display of the basis.
Rigpa has three wisdoms, two of which are kadag and lhun grub. Kadag (primordial purity) is the Dzogchen view of emptiness. Lhun grub (natural formation) is the Dzogchen view of dependent origination. Throughout Mahayana, emptiness and dependent origination are two sides of the same coin. Kadag deals with tregchöd. The lhun grub aspect has to do with esoteric practices, such as (but not limited to) Thödgal, that self-liberate the dependently originated human body into the Sambhogakāya (rainbow body phenomenon). The symbol of Dzogchen is a Tibetan A wrapped in a thigle (see picture to the right). The A represents kadag while the thigle represents lhun grub. The third wisdom, thugs rje (compassion), is the inseparability of the previous two wisdoms.
The ultimate fruition of the thodgal practices is a body of pure light, called a rainbow body (Wylie 'ja' lus, pronounced Jalü.) If the four visions of thogal are not completed before death, then at death, from the point of view of an external observer, the following happens: the corpse does not start to decompose, but starts to shrink until it disappears. Usually fingernails, toenails and hair are left behind (see e.g. Togden Urgyen Tendzin, Ayu Khandro, Changchub Dorje.) The attainment of the rainbow body is typically accompanied by the appearance of lights and rainbows.
Some exceptional practitioners such as Padmasambhava and Vimalamitra are held to have realized a higher type of rainbow body without dying. Having completed the four visions before death, the individual focuses on the lights that surround the fingers. His or her physical body self-liberates into a nonmaterial body of light (a Sambhogakāya) with the ability to exist and abide wherever and whenever as pointed by one's compassion.
Read more about this topic: Rainbow Body