Dye



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

Dyeing wool and sheep
Dyes can be placed with (only) white wool on a crafting table (in any position) to color it. This will only dye one block of wool per unit of dye. Dyes can also be used on sheep to paint them, after which they will give wool of the painted color. After shearing colored sheep, they will regenerate their wool, in the new color, by eating grass. Additionally, there are naturally occurring gray, light gray, black, brown and pink sheep that drop corresponding color wool as well. Painting and shearing sheep is a far more efficient use of dyes than dyeing the wool directly, but accumulated dyes remain useful for coloring wool crafted from string (e.g. in an Abandoned Mineshaft). Bone meal can be used to "bleach" sheep, but not wool blocks. Not all of the dyes are renewable, but the colored wool itself is. As of 12w34a, it is possible to dye wolf collars.

Armor dyeing
As of 12w34a, leather armor can be dyed by placing dyes in the crafting bench with a piece of leather armor. There are 12,326,391 possible 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.

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 tested. 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 will never be darker than the average of the input colors, and will often be lighter and more saturated. Of course, the resulting color will never be lighter or more saturated than the lightest or most saturated input color. In addition, this formula will never create an RGB value higher than 255 (which is invalid in the RGB color model).

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.
 * This behaviour mirrors Lamarck´s theory, in which the organisms evolve inheriting the external changes and adaptations of the previous generation, transmitting them to their offspring.

Farbstoff Wool Dyes/es Colorant 염색약 Kleurstoffen Barwniki pt-br:Tinturas de Tecido Красители 羊毛染料