Dye

Dyes are a set of sixteen items used to change the color of wool, carpets, terracotta, concrete powder, glass, shulker boxes, beds, candles, the patterns on banners, firework stars, certain mobs, and text on signs and hanging 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.
=== Smelting ===
=== 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.
=== Chest loot ===
=== 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 carpets ===
Carpets can be dyed.
=== Dyeing terracotta ===
Terracotta can be dyed by placing 8 blocks around a dye on a crafting table.
=== 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).
=== 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 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.
=== Dyeing beds ===
Players can dye beds by placing a bed and any color dye in a crafting grid.
=== Dyeing candles ===
Players can dye candles by placing an undyed candle and any color dye in a crafting grid.
=== Banner patterns ===
Dyes are used in most banner patterns to determine the pattern and color displayed.
=== 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,438https://anrar4.github.io/DyeLeatherArmor/ (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.
=== Creating balloons ===
Dye can be used to craft balloons.
=== Creating glow sticks ===
Dye can also be used to craft glow sticks.
=== 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 on a sign or a hanging sign to change the text color. , ink sacs cannot be used for this purpose; black dye must be used to change the text to black.
=== Trading ===
Apprentice, journeyman and expert-level shepherd villagers buy any of the 12 dyes for an emerald.
== Color values ==
The "color codes" are used to determine the color imparted on sheep, wolf and cat collars, firework stars, beacon beams, 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. The color values for firework stars are slightly different from the ones listed below, and use these values instead.
Description	Color Code	Color Code
Description	Dec 	Hex
White 	16383998 	
Light gray 	10329495 	
Gray 	4673362 	
Black 	1908001 	
Brown 	8606770 	
Red 	11546150 	
Orange 	16351261 	
Yellow 	16701501 	
Lime 	8439583 	
Green 	6192150 	
Cyan 	1481884 	
Light blue 	3847130 	
Blue 	3949738 	
Purple 	8991416 	
Magenta 	13061821 	
Pink 	15961002 	
== Sounds ==
:
:
== Achievements ==
== Video ==
== History ==
Pre-release dyes.png|Pre-release dye textures hidden within Items.png.
;Notes
== Gallery ==
White Dye.png|White Dye
Light Gray Dye.png|Light Gray Dye
Gray Dye.png|Gray Dye
Black Dye.png|Black Dye
Brown Dye.png|Brown Dye
Red Dye.png|Red Dye
Orange Dye.png|Orange Dye
Yellow Dye.png|Yellow Dye
Lime Dye.png|Lime Dye
Green Dye.png|Green Dye
Cyan Dye.png|Cyan Dye
Light Blue Dye.png|Light Blue Dye
Blue Dye.png|Blue Dye
Purple Dye.png|Purple Dye
Magenta Dye.png|Magenta Dye
Pink Dye.png|Pink Dye
==Issues==
== 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).
* The texture for light blue dye still uses the color from prior to the 1.12 World of Color update.
== References ==
== External Links ==
* Tools for calculating leather dye combination: minecraft.tools (webapp); pyMCDyes (open-source Python script, outdated); DyeLeatherArmor: a tool for calculating an exact crafting recipe for any sRGB color
Category:Dyes
Category:Renewable resources
cs:Barvivo
de:Farbstoff
es:Tinte
fr:Teinture
hu:Színezés
it:Colorante
ja:染料
ko:염료
nl:Kleurstof
pl:Barwniki
pt:Corante
ru:Красители
th:สีย้อม
uk:Барвники
zh:染料