"Melanin is what gives colour to human hair and animal fur," said Professor Mike Benton from the University of Bristol, UK, who led this study. "They are also the most common way that colours are [produced] in feathers."
Professor Benton explained that differently shaped melanosomes produced different colours, with blacks or greys produced by "sausage-shaped" melanosomes, and reddish or "russet" shades found in spherical ones.
"A ginger-haired person would have more spherical melanosomes, and a black-haired or grey-haired person would have more of the sausage-shaped structures," said Professor Benton.
The scientists found both types of melanosome in Confuciusornis and decided to turn their attention to Sinosauropteryx, which is the most primitive feathered dinosaur yet found.
The bristles that are visible in the fossils were coloured feathers
It was about the size of a turkey and would have fed on lizards and other small prey.
"There's a very clear rim of feathers running down the top of its head like a Mohican, all the way along its back," Professor Benton described.
Bands of dark and light along the tail can be seen in the fossils. This close examination has shown that the dinosaur's "Mohican" was russet or ginger-coloured, and that these bands were in fact ginger and white stripes.
"This is the first time anyone has ever had evidence of original colour of feathers in dinosaurs," said Professor Benton.
He said the study has also confirmed that the bristles on this "rather primitive flesh-eating dinosaur... really were feathers".
This gives more weight to a very well-supported theory that modern birds evolved from theropods, the group of small carnivorous dinosaurs to which Sinosauropteryx belonged.
"Critics have said that these visible spiny structures could be shredded connective tissue," Professor Benton explained. "But the discovery of melanosomes within the bristles finally proves that some early dinosaurs were indeed feathered."
The findings also help to resolve a long-standing debate about the evolution and original function of feathers.
"We now know that feathers did not originate as flight structures," said Professor Benton. This suggests that they evolved, initially, for insulation and perhaps for display.
Feathers could have evolved for insulation or display
Dr Richard Butler, a palaeontologist at the Bavarian State Collection for Palaeontology, in Munich, Germany, said this was a "fascinating and exciting discovery with important implications for understanding dinosaur evolution and biology".
Dr Butler, who was not involved in this research, told BBC News: "When people ask how we know what colour dinosaurs were, the answer has always been that we make an educated guess.
"This discovery suggests that with more work we may be able to accurately reconstruct colour patterns in some dinosaur species, and begin to understand how those colour patterns may have functioned for camouflage or display."
What are these?