Dye

Dyes are a set of items used to change the color of wool, leather armor, terracotta, certain mobs, the patterns on banners, shulker boxes, glass, shulkers, concrete powder, and beds.

Obtaining
Most dyes are produced by crafting various flowers or other items, or by combining other dyes.

Trading
Wandering traders can sell 3 dyes for an emerald.

$$, wandering traders can sell 3 lapis lazuli, bone meal, cocoa beans, or ink sacs for one emerald.

Apprentice-level cleric Villagers sell one lapis lazuli per emerald.

Other
Blue dye can be crafted from Lapis Lazuli, which is mined from ores underground in amounts of 4–8 per block.

Brown dye can be crafted from cocoa beans, which are harvested from cocoa pods in amounts of 1–3 per fully grown pod. A pod that is not fully grown yields one cocoa bean.

Black dye can be crafted from ink sacs, which can be dropped when a squid dies, in amounts of 1–3 per squid. Using the Looting enchantment can increase this amount.

Ink sacs can also be created using 1 iron, 1 sulfur, and 4 oxygen in the compound creator.

Dyeing wool and mobs
Players can dye wool by placing white wool and a dye in a crafting grid.

Dyes can be on sheep to change the color of the wool. Shearing a colored sheep drops the corresponding color of the wool, and the sheep retains the color when the wool regenerates. Breeding colored sheep produces a lamb colored as one of the parent sheep, or a color resulting from the combination of both parents' color. The color combining follows the same rules that dyes use – red and yellow sheep produce an orange lamb, but a blue and yellow sheep cannot create a green lamb. The unlimited reproduction of colored sheep makes dyeing and shearing sheep infinitely more efficient than just dyeing wool directly. Dye can also be used on tamed wolves and cats. a dye on one of these tamed animals changes the color of its collar from the default red to the color of the dye.

Dye can also be used on shulkers to change the color of the shell.

Dyeing terracotta
Terracotta can be dyed by placing 8 blocks around a dye on a crafting table.

Staining glass
Stained glass can be stained by placing 8 blocks of glass around a dye on a crafting table. Just like regular glass, stained glass can be crafted into stained glass panes. The recipe for this is the same as with regular glass.

Dyeing armor


Leather armor can be dyed by:
 * Crafting dyes with a piece of leather armor or leather horse armor.
 * Dousing the leather armor or leather horse armor in a cauldron to which dyes have been added.

There is a possible combination of 12,326,391 colors, as it is possible to put more than one dye on the crafting bench alongside the leather armor. Armor can be dyed multiple times with previous colors affecting the final outcome. Colored armor can be reverted to their original color using a cauldron with undyed water.

The game has a specific formula for calculating the color of dyed armor: each color, in the RGB color model, has a red value, green value, and blue value. For each dye in the crafting grid, and the armor itself (if it is already dyed), the red, green, and blue values are added to running totals. In addition, a running total of the highest value (be it red, green, or blue) is also kept. After this, each total is divided by the number of colors used. This effectively produces the average red, green, blue, and maximum values. The maximum value of the average RGB values is also calculated. Finally, each average RGB value is multiplied by the average maximum value and divided by the maximum of the average RGB values. The modified average RGB values are then used as the final color. This procedure can be summed up with the following equations: for each color (all "total" variables start at 0 before counting): totalRed = totalRed + redValue totalGreen = totalGreen + greenValue totalBlue = totalBlue + blueValue totalMaximum = totalMaximum + max(red, green, blue) numberOfColors = numberOfColors + 1 averageRed = totalRed / numberOfColors averageGreen = totalGreen / numberOfColors averageBlue = totalBlue / numberOfColors averageMaximum = totalMaximum / numberOfColors maximumOfAverage = max(averageRed, averageGreen, averageBlue) gainFactor = averageMaximum / maximumOfAverage resultRed = averageRed * gainFactor resultGreen = averageGreen * gainFactor resultBlue = averageBlue * gainFactor

Due to the way this formula works, the resulting color can never be darker than the average of the input colors and is often lighter and more saturated. Of course, the resulting color can never be lighter or more saturated than the lightest or most saturated input color. In addition, this formula never creates an RGB value higher than 255 (which would be invalid in the 8-bit RGB color model).

If leather armor is renamed on an anvil, it retains its name when dyed or undyed.

Dyeing firework stars
A firework star can have a single color or a combination of up to eight colors when crafted with dyes. Adding one or more dyes to a crafted firework star adds a "fade to color" effect to it, overwriting any existing fade colors.

Banner patterns
Dyes are used in most banner patterns to determine the pattern and color displayed.

Dyeing shulker boxes
Shulker boxes are generated in a light shade of purple (like the purpur block), but can be dyed any color. They can also be re-dyed as often as desired.

Creating concrete powder
Dyes can also be used to craft concrete powder, which can then be set into their respective concrete blocks (they cannot be dyed directly).

Creating balloons
Dye can be used to craft balloons.

Creating glow sticks
Dye can also be used to craft glow sticks.

Dyeing beds
Players can dye beds by placing a white bed and any color dye in a crafting grid. Only white beds can be dyed.

Dyeing water inside cauldrons
Water can be dyed in a cauldron by holding any dye in the hand and pressing on a cauldron filled with water.

Signs
Dye can be used on a sign to change the text color.

Trading
12 dye can be sold to shepherd villager.

Other uses
Dyes have other uses specific to those colors; see their separate articles for details.
 * Ink sacs are used to craft dark prismarine and book and quill, and sold to librarian villager.
 * Cocoa beans are used to craft cookies and can be planted on the side of a jungle wood block to grow more cocoa beans.
 * Lapis lazuli is used in enchanting and to craft the lapis lazuli block.
 * Bone meal is used to fertilize various plants, craft the bone block, and create huge mushrooms.

These items all have dye color equivalents.

Primary
These primary dyes are created only from ingredients spawned naturally in a world.

Quasi-Primary
These dyes can be created from a single ingredient spawned naturally in a world, or by combining other dyes.

Secondary
Secondary dyes are created by combining primary dyes together.

ID
Java Edition:

Bedrock Edition:

Item data
The color of a dyed item depends on its metadata. The "color codes" are used to determine the color imparted on sheep, wolf collars, and dyed leather armor. The hex value is shown in the extended tooltips of dyed leather armor; however, to set the color using an NBT data tag in a command, the decimal value must be used instead.

Trivia

 * Players can obtain each one of every color with 1 cocoa bean, 2 yellow dye, 2 ink sac, 3 green dye, 4 lapis lazuli, 4 red dye, and 6 bone meal (2 bones).
 * The dyed sheep breeding behavior mirrors Lamarck's theory, in which the organisms evolve inheriting the external changes and adaptations of the previous generation, transmitting them to their offspring.
 * In Bedrock Edition, tertiary colors, along with their regular crafting recipes, can be crafted with primary colors. E.g.: Magenta can be crafted with one rose red and two bone meals.
 * The colors of the dyes match the chat colors in color codes except for brown (dye only), light aqua, and gold (color codes only).