"M&M's"® Plain Chocolate Candies were first introduced to the public in 1941, and were made available to American G.I.s during World War II. The name comes from the founders of the company, Mars and Murrie. The official website has this to say on the origin of the concept of small chocolate disks in hard candy shells:

Who would have guessed that the idea for "M&M's"® Plain Chocolate Candies was born in the backdrop of the Spanish Civil War? Legend has it that on a trip to Spain, Forrest Mars Sr. encountered soldiers who were eating pellets of chocolate that were encased in a hard sugary coating to prevent them from melting. Inspired by this idea, Mr. Mars went back to his kitchen and invented the recipe for "M&M's"® Plain Chocolate Candies.
The candies eventually gained significant popularity in the late 1940's when M&M/Mars put them into wide distribution. Initially, "M&M's"® were packaged in cardboard tubes, but in 1948, they switched to the brown paper packets that would become such a recognizable symbol. The initial color set for "M&M's"® comprised red, yellow, green, brown, orange, violet. Also, the printed lowercase "m" on the candies was black, not white.

In the 1950's, "M&M's"® increased greatly in popularity, due in large part to the advent of television. In 1954, the first television commercial for "M&M's"® aired, featuring the slogan that would serve the company so well: "The milk chocolate that melts in your mouth, not in your hand."® It was in this same year that peanut "M&M's"® ("M&M's"® Peanut Chocolate Candies) appeared. It was also in this year that "M&M's"® changed the color of the letter "m" printed on the candies from black to white.

In 1972, the first "M&M's"® Brand Characters were introduced, thus furthering humanity's fascination with the consumption of intelligent food that doesn't wish to be eaten. In 1976, the color red was removed from "M&M's"® as a result of a scare over a certain red food coloring, red dye #2. In actuality, "M&M's"® never contained the offending dye, but the company wished to distance itself from the scandal nonetheless. Red "M&M's"® were brought back in 1987, due to "overwhelming requests from customers," according to the "M&M's"® website.

The 1990's saw many additions for "M&M's"®. First, "M&M's"® Peanut Butter Chocolate Candies and "M&M's"® Almond Chocolate Candies debuted early in the decade. Then, in 1995, "M&M's"® had a large marketing campaign that allowed the public to choose a new color to be introduced into their color lineup. Voters chose blue over pink and purple, with blue getting 54% of the total votes, which were in excess of 10 million.

In terms of marketing, 1996 was nearly as important a year for "M&M's"® as 1954 was, with the ad campaign featuring the popular "M&M's"® Brand Characters gaining the public's attention as well as that of critics. USA Today ranked the campaign #1 over 60 other advertising campaigns. It was also in this year that both the "M&M's"® MINIs Milk Chocolate Candies and "M&M's"® COLORWORKS® were introduced. MINIs, originally created for easier use of M&M's in baking, were later packaged in resealable plastic tubes for easier snacking. COLORWORKS® allowed customers to pick "M&M's"® from a variety of over 20 colors, for special occasions and the like. Secretly, these products were introduced for the sole purpose of driving me insane by making me type ® over and over again, but an "M&M's"® spokesperson declined to comment on these blatant machinations.

In 1997, "M&M's"® World, the brand's retail store, had its grand opening on the Las Vegas strip, and in 1998, with yet another clever marketing stunt, the "M&M's"® Characters declared themselves to be the "Official Spokescandies of the New Millennium", since in Roman numerals, M is 1000, and they've got 2 M's. In the year 2000, "M&M's"® Plain Chocolate Candies were renamed to "M&M's"® Milk Chocolate Candies, as they felt that "plain" had too negative of a connotation. Continuing the trend of new products, in December 1998, "M&M's"® Crispy Chocolate Candies debuted, and in 2001, "M&M's"® Dulce de Leche~Caramel Chocolate Candies were introduced.

Another contest to determine a new color was run in 2002, this time with the available colors being pink, purple, and aqua. Purple won, with aqua coming in second and pink trailing significantly. I actually recommend going to the official website and looking at the Shockwave Flash applet they have which shows how the voting went per country. Check out http://www.mms.com/ . I do warn you that the site in general is extremely Flash-intensive, however.

Update 10/14/2002

I happened to have some M&M's a couple days ago and purple is now in packages being distributed to the public. It has not replaced any other color, bringing the number of colors in a standard package of "M&M's"® Milk Chocolate Candies to 7. The M&M's Website unfortunately does not have the new color distribution listed, however. I could buy several packages and count them myself, but that is notoriously unreliable.

"M&M's"® Changes in Color Lineups Over Time

As stated above, plain "M&M's"® originally came as red, yellow, green, brown, orange, and violet. In 1949, tan replaced violet. In 1995, blue replaced tan. In 2002, purple was added.

Peanut "M&M's"® were actually originally exclusively brown. In 1960, red, green, and yellow were added, followed by orange in 1976, and blue in 1995, bringing Peanut M&M's into sync with the plain. Peanut Butter and Almond flavors use the same set as the other two, with the exception of orange, which is not used. Crispy "M&M's"®, however, use the same set as plain and peanut, as do "M&M's"® MINIs and the Dulce de Leche flavor.

Distribution of Colors in "M&M's"®

"M&M's"® Milk Chocolate Candies and "M&M's"® Baking Bits Chocolate Candies
Brown:  30%
Yellow: 20%
Red:    20%
Orange: 10%
Green:  10%
Blue:   10%
"M&M's"® Peanut Chocolate Candies
Brown:  20%
Yellow: 20%
Red:    20%
Blue:   20%
Green:  10%
Orange: 10%
"M&M's"® Almond Chocolate Candies and "M&M's"® Peanut Butter Chocolate Candies
Brown:  20%
Yellow: 20%
Red:    20%
Green:  20%
Blue:   20%
"M&M's"® Crispy Chocolate Candies, "M&M's"® Dulce de Leche~Caramel Chocolate Candies, and "M&M's"® Brand MINIs
Brown:     16.6%
Yellow:    16.6%
Red:       16.6%
Blue:      16.6%
Green:     16.6%
Orange:    16.6%
Invisible:  0.4%


Sources:
"M&M's" About History Page. http://global.mms.com/us/about/history/index.jsp
M&M/Mars Consumer Affairs Information | "M&M's" ®. http://www.m-ms.com/cai/mms/faq.html