The introduction of margarine, or oleomargarine, as a butter substitute, did not always come smoothly. Customers were reluctant at first to use a product whose ingredients they did not necessarily know (between 1870 and 1886, 180 different patents on types of margarines were applied for in the United States). Mark Twain's Life on the Mississippi includes a salesman talking about the benefits of this product: "You can't tell it from butter; by George an expert can't!" Dairy farmers called the new product "bogus butter." When butter and margarine were often sold by scoops out of large barrels in stores, customers worried over getting the right one (the only time you could really tell was if the butter had spoiled).

An article in Puck magazine sarcastically suggested that margarine be dyed pink, red, or green so that it could be identified. By 1880 a toned-down version of this idea had become popular; most U.S. states forbade margarine to be colored yellow before sale (even though butter made in winter tended to be white and often needed the same annatto coloring used in margarine) and in 1902 the Supreme Court upheld these bans. Packaged margarine was often sold with separate envelopes of coloring, and childen were frequently given the task of mixing them together. Margarine was also taxed more than butter in the U.S., and Canada outlawed margarine completely from 1886 to 1949. In 1950 the U.S. finally passed the Federal Margarine Act, which allowed yellow coloring, though it did have to be prominently labeled. Stavr0 informs me that Quebec still has laws against yellow coloring, due to lobbying by the dairy industry, though the remainder of Canada allows pre-colored margarine.

Carlson, Laurie Wynn. Cattle: An Informal Social History. Chicago: Ivan R. Dee, 2001.