Dye

Wool dyes are items used to change the color of wool. There are currently 16 dyes, including seven "primary" dyes (red, yellow, blue, green, white, black and brown), seven "secondary" dyes, and two "tertiary" dyes.

History
Wool dyes were added in the Beta 1.2 update.

Update 1.1 gave sheep the ability to regrow their wool by eating grass. Dyed sheep will regrow wool in their new color.

Snapshot 12w34a gave you the ability to dye leather Armor and Wolf Collars.

Uses
Dyes can be placed with wool on a crafting table (in any position) to dye a single block. It can also be used on sheep to paint them. When shearing a painted sheep, the wool dropped will be the painted color, sometimes yielding more colored wool than from crafting (see Notes section). Not all of the dyes are renewable, but the colored wool itself is. After shearing colored sheep, they will regenerate their wool by eating grass (11w49a). Additionally, there are naturally occurring gray, light gray, black, brown and pink sheep that drop corresponding color wool as well. Note, only white wool can be dyed via crafting – painting colored sheep is the only way to dye non-white wool. For example, you can get "bleached" wool by using white dye on a colored sheep. As of 12w34a, Leather armor can be dyed by placing dyes in the crafting bench with the piece of leather armor you wish to dye. There are 12,326,391 possible colors, since you can put more than one dye on the crafting bench alongside the leather armor, and if you try to dye an item that has previously been dyed, the previous color affects the final color. Leather armor can be "washed" by right clicking a full cauldron to remove all the dye. Also in 12w34a, you can dye Wolfs collars.

Primary Colors
These primary dyes are created from a single ingredient spawned naturally in a world.

Secondary Colors
Secondary dyes are created by combining primary dyes together.

Tertiary Colors
Tertiary dyes are created by combining at least one secondary dye.

Data Values
The color of a dye item depends on a secondary data field (beyond the item ID of 254), which is also used to store the damage for tools and so is commonly referred to as a “damage value”. The "color codes" are used to determine the color imparted on sheep, wolf collars, and leather armor.

Trivia

 * The reversed color values closely resemble an ANSI or VGA palette with the biggest outlier being orange.
 * The metadata values for wool and wool dyes are the inverse of one another, with white wool having a metadata value of 0, bone meal 15; orange wool having a value of 1, orange dye 14 and so on.
 * Giving yourself a dye with a damage value greater than 15 will result in an object which resembles some other in-game item, such as a wooden tool, and moving the mouse over the item to view its tooltip text will crash the game.
 * Dyeing sheep has always been more efficient than dyeing wool, because you can get more than one colored wool per sheep. This is especially true now that sheep can regrow their wool endlessly, as long as you use shears and keep the sheep safe and well-fed.