Colors

From The Stardew Modding Wiki
Jump to navigation Jump to search
This is the dye function, which lists all the colors available by name in the game.
public static Color? GetDyeColor(Item dye_object)
{
	if (dye_object != null)
	{
		if (dye_object.Name == "Prismatic Shard")
		{
			return Color.White;
		}
		if (dye_object is ColoredObject)
		{
			return (dye_object as ColoredObject).color;
		}
		Dictionary<string, Color> color_dictionary = new Dictionary<string, Color>();
		color_dictionary["black"] = new Color(45, 45, 45);
		color_dictionary["gray"] = Color.Gray;
		color_dictionary["white"] = Color.White;
		color_dictionary["pink"] = new Color(255, 163, 186);
		color_dictionary["red"] = new Color(220, 0, 0);
		color_dictionary["orange"] = new Color(255, 128, 0);
		color_dictionary["yellow"] = new Color(255, 230, 0);
		color_dictionary["green"] = new Color(10, 143, 0);
		color_dictionary["blue"] = new Color(46, 85, 183);
		color_dictionary["purple"] = new Color(115, 41, 181);
		color_dictionary["brown"] = new Color(130, 73, 37);
		color_dictionary["light_cyan"] = new Color(180, 255, 255);
		color_dictionary["cyan"] = Color.Cyan;
		color_dictionary["aquamarine"] = Color.Aquamarine;
		color_dictionary["sea_green"] = Color.SeaGreen;
		color_dictionary["lime"] = Color.Lime;
		color_dictionary["yellow_green"] = Color.GreenYellow;
		color_dictionary["pale_violet_red"] = Color.PaleVioletRed;
		color_dictionary["salmon"] = new Color(255, 85, 95);
		color_dictionary["jade"] = new Color(130, 158, 93);
		color_dictionary["sand"] = Color.NavajoWhite;
		color_dictionary["poppyseed"] = new Color(82, 47, 153);
		color_dictionary["dark_red"] = Color.DarkRed;
		color_dictionary["dark_orange"] = Color.DarkOrange;
		color_dictionary["dark_yellow"] = Color.DarkGoldenrod;
		color_dictionary["dark_green"] = Color.DarkGreen;
		color_dictionary["dark_blue"] = Color.DarkBlue;
		color_dictionary["dark_purple"] = Color.DarkViolet;
		color_dictionary["dark_pink"] = Color.DeepPink;
		color_dictionary["dark_cyan"] = Color.DarkCyan;
		color_dictionary["dark_gray"] = Color.DarkGray;
		color_dictionary["dark_brown"] = Color.SaddleBrown;
		color_dictionary["gold"] = Color.Gold;
		color_dictionary["copper"] = new Color(179, 85, 0);
		color_dictionary["iron"] = new Color(197, 213, 224);
		color_dictionary["iridium"] = new Color(105, 15, 255);
		foreach (string key in color_dictionary.Keys)
		{
			if (dye_object.HasContextTag("color_" + key))
			{
				return color_dictionary[key];
			}
		}
	}
	return null;