Code/CharacterKit/MakeupCatalog.cs

Static catalog of face makeup layers and their color options. It maps layer names to MakeupLayerData on a CharacterMakeupData instance, provides predefined color palettes for each layer, a helper to construct AppearanceColorOption, and a Reset method that restores defaults for a given layer.

namespace CharacterEditor;
/// <summary>Original human-face cosmetics; colors are display RGB, separate from skin tint.</summary>
public static class MakeupCatalog
{
	public static IReadOnlyList<string> Layers => new[]
	{
		"Lipstick",
		"Eyeshadow",
		"Eyeliner",
		"Lower-eye shadow",
		"Blush",
		"Tattoo"
	};

	public static MakeupLayerData Layer(CharacterMakeupData data, string layer) => layer switch
	{
		"Eyeliner" => data.Eyeliner,
		"Lower-eye shadow" => data.LowerEyeshadow,
		"Eyeshadow" => data.Eyeshadow,
		"Blush" => data.Blush,
		"Tattoo" => data.Tattoo,
		_ => data.Lipstick
	};
	public static IReadOnlyList<AppearanceColorOption> Colors(string layer) => layer switch
	{
		"Blush" => new[]
		{
			Color("rose", "Rose", .7f, .3f, .32f),
			Color("peach", "Peach", .85f, .46f, .33f),
			Color("berry", "Berry", .5f, .16f, .27f),
			Color("warm", "Warm", .65f, .34f, .26f)
		},
		"Tattoo" => new[]
		{
			Color("ink", "Ink", .1f, .12f, .16f),
			Color("wine", "Wine", .3f, .08f, .12f),
			Color("indigo", "Indigo", .12f, .15f, .34f),
			Color("ivory", "Ivory", .8f, .77f, .67f)
		},
		"Eyeliner" => new[]
		{
			Color("black", "Black", .025f, .02f, .025f),
			Color("brown", "Brown", .12f, .065f, .035f),
			Color("charcoal", "Charcoal", .08f, .08f, .1f),
			Color("plum", "Plum", .18f, .06f, .16f),
			Color("blue", "Midnight", .035f, .08f, .19f)
		},
		"Eyeshadow" or "Lower-eye shadow" => new[]
		{
			Color("plum", "Plum", .2f, .12f, .28f),
			Color("smoke", "Smoke", .08f, .08f, .1f),
			Color("bronze", "Bronze", .45f, .25f, .12f),
			Color("blue", "Blue", .1f, .25f, .5f),
			Color("moss", "Moss", .18f, .3f, .21f),
			Color("rose", "Rose", .5f, .2f, .3f)
		},
		_ => new[]
		{
			Color("rose", "Rose", .5f, .12f, .18f),
			Color("scarlet", "Scarlet", .65f, .06f, .08f),
			Color("berry", "Berry", .3f, .06f, .16f),
			Color("nude", "Nude", .58f, .33f, .28f),
			Color("plum", "Plum", .23f, .08f, .27f),
			Color("black", "Black", .035f, .025f, .035f)
		}
	};
	static AppearanceColorOption Color(string id, string label, float r, float g, float b) => new(id, label, new(r, g, b));
	public static void Reset(CharacterMakeupData data, string layer)
	{
		var defaults = new CharacterMakeupData();
		var source = Layer(defaults, layer);
		var target = Layer(data, layer);
		target.Color = source.Color;
		target.Amount = 0;
		if (layer == "Eyeliner")
		{
			data.EyelinerLowerStrength = 0;
			data.EyelinerInnerStrength = 0;
			data.EyelinerWing = "none";
			data.EyelinerWingStrength = 1;
			data.EyelinerWingHorizontal = .25f;
			data.EyelinerWingVertical = 0;
			data.EyelinerWingThickness = .25f;
		}
		if (layer == "Tattoo")
			data.TattooStyle = "none";
	}
}