Dye

Dyes are a set of 16 items used to change the color of wool, terracotta, certain mobs, the patterns on banners, shulker boxes, glass, concrete powder, candles, beds, firework stars, and text on signs. $$ they can also be used to dye water in a cauldron (which is thereafter used to dye leather armor); $$ leather armor can be dyed directly. $$ dyes can also be used to dye balloons and glow sticks.

$$, bone meal, ink sacs, lapis lazuli, and cocoa beans can generally substitute for white dye, black dye, blue dye, and brown dye, respectively, in crafting recipes and for use in dyeing items or mobs. However, they have other important uses that aren't related to color, and are therefore not considered true dyes. They are mentioned in this article only in regard to their use as dyeing agents; see their individual articles for complete information about them.

Obtaining
Dyes can be produced by crafting them from plants (mainly flowers), by crafting dyes of different colors together, by smelting plants, or by trading with a Wandering trader.

Trading
Wandering traders can sell 3 dyes for an emerald. $$, they can also 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
Ink sacs can also be created using 1 iron, 1 sulfur, and 4 oxygen in the compound creator.

Usage
Similar to their use in crafting, bone meal, ink sacs, lapis lazuli, and cocoa beans can be substituted for the corresponding dye in any of the following usages unless otherwise specified.

Dyeing wool and mobs
Players can dye wool by placing wool and any 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 a tamed wolf or cat to change the color of its collar from the default red to the color of the dye.

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 are 5,713,438 (34.1% of sRGB) colors leather armor can be, 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(redValue, greenValue, blueValue) 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.


 * Mixing Samples

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 bed and any color dye in a crafting grid.

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.

Dyeing candles
Players can dye candles by placing an undyed candle and any color dye in a crafting grid.

Signs
Dye can be on a sign to change the text color. $$, ink sacs cannot be used for this purpose; you must use black dye to change the text to black.

Trading
Shepherd villagers can buy 12 dyes.

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.

ID have been split up into their own IDs.}}

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).