Dye

Dyes are a set of 23 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 also be dyed directly.

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

### Crafting

* Allium - Magenta Dye
* Azure Bluet - Light Gray Dye
* Bone Meal - White Dye
* Blue Orchid - Light Blue Dye
* Blue Hydrangea - Ultramarine Dye
* Buttercup - Orange Dye
* Cocoa Bean - Brown Dye
* Cornflower - Blue Dye
* Daffodil - Chartreuse Dye
* Dandelion - Yellow Dye
* Forget-me-not - Capri Dye
* Ink Sac - Black Dye
* Iris - Violet Dye
* Lapis Lazuli - Blue Dye
* Lilac - Magenta Dye
* Lily of the Valley - White Dye
* Orange Tulip - Orange Dye
* Oxeye Daisy - Light Gray Dye
* Peony - Pink Dye
* Pink Hydrangea - Rose Dye
* Pink Tulip - Pink Dye
* Poppy - Red Dye
* Purple Hydrangea - Indigo Dye
* Red Hydrangea - Rose Dye
* Red Tulip - Red Dye
* Rose Bush - Red Dye
* Sunflower - Yellow Dye
* White Tulip - Light Gray Dye
* Wither Rose - Black Dye

### Smelting

* Algae - Spring Green Dye
* Cactus - Green Dye
* Sea Pickle - Lime Green Dye

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

## Usage

### Dyeing wool and mobs

Players can dye wool by placing wool and any dye in a crafting grid.

Dyes can be used 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 and Cloth 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.

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

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

### 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 use 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 used on a sign to change the text color. In Bedrock Edition, ink sacs cannot be used for this purpose; you must use black dye to change the text to black.

### Trading

Apprentice, journeyman and expert-level shepherd villagers buy any of the 12 dyes for an emerald.