Dogs only come in one of two colours — black or yellow — according to scientists at Stanford University's medical school.

Researchers at the California university isolated the colour of dogs' coats to one gene, which produces two versions of a protein called a beta-defensin. After testing the DNA of hundreds of dogs, they found that one version yields yellow dogs while another, mutant version results in black dogs.

"A Dalmatian looks white with black spots, but based on its genetics, it's black. Dogs that are chocolate — like one of my dogs, a chocolate poodle — are also a modification of black," said Greg Barsh, the genetics professor who led the study, in a release. His other dog, an apricot poodle, is genetically yellow, as are Irish setters, he said.

Chris Kaelin, co-author of the study, said he proved the argument by injecting the gene into transgenic mice, which then turned black.

The researchers report their findings in the Nov. 2 issue of the journal Science. They say the colour of dogs could have implications on drug research, as the discovered defensin gene is also believed to be involved in fighting microbes.