As he began to teach inorganic chemistry, Mendeleev could not find a textbook that met his needs. Since he had already published a textbook on organic chemistry in 1861 that had been awarded the prestigious Demidov Prize, he set out to write another one. The result was Osnovy khimii (1868–71; The Principles of Chemistry), which became a classic, running through many editions and many translations. When Mendeleev began to compose the chapter on the halogen elements (chlorine and its analogs) at the end of the first volume, he compared the properties of this group of elements to those of the group of alkali metals such as sodium. Within these two groups of dissimilar elements, he discovered similarities in the progression of atomic weights, and he wondered if other groups of elements exhibited similar properties. After studying the alkaline earths, Mendeleev established that the order of atomic weights could be used not only to arrange the elements within each group but also to arrange the groups themselves. Thus, in his effort to make sense of the extensive knowledge that already existed of the chemical and physical properties of the chemical elements and their compounds, Mendeleev discovered the periodic law.
While he was researching and writing that book in the 1860s, Mendeleyev made the discovery that led to his most famous achievement. He noticed certain recurring patterns between different groups of elements and, using existing knowledge of the elements' chemical and physical properties, he was able to make further connections. He systematically arranged the dozens of known elements by atomic weight in a grid-like diagram; following this system, he could even predict the qualities of still-unknown elements. In 1869, Mendeleyev formally presented his discovery of the periodic law to the Russian Chemical Society.
The colored light emitted is energy and in order to emit energy the element should first obtain energy. The energy absorbed by the substance can be in the form of radiation, heat or electricity. Hope this answers the question. Have a nice day.