Yanks , is your code "Usable "? It may be quicker to team up with 54X and work towards a mix of both techniques ( several new sprites designs plus colour shifting for Race by your code)
My approach essentially puts all the burden on the image creator, and if properly coded we could simply have the customisation part of the engine read the relevant directory to ensure it contains all necessary images using the naming format, a paletted PNG and of a 32x40 size. All the programmer will have to do is re-code the battlescape to automatically load up a bunch of PNGs, and allow it to load unlimited haircuts with distinct names for each ethnicity, and then it will never require any coding work ever again. (Well, I suppose we might have to add those soldier variables to the save files too, and if we're wanting to be really thorough we'll change the name generation at some point to have ethnic lists that correspond with those variables. But adding a new haircut never has to break a save, just have it add a higher number to the haircut variable and then sort them alphabetically in the loading code, so all you have to do is not delete haircuts without replacing them)
I've got a standard filename template for each one, too, in the format of:
f eu ponytail re north
[f/f1/m/m1] = Gender/armour combination. *1 is personal armour, no number is unarmoured, but if it helps I can change that to *0.
eu = ethnicity. I was thinking something like Af, (African) As, (Asian) and La (Latin) for remaining skin tones.
ponytail = short name for haircut. Currently ponytail and Flattop, next I'll add the male "short" that moriarty did, and then probably go to work on creating a female "long"
re = hair colour. I'm using bl, br, and bk for the other three colours.
north = this is a name for the sprite that will reference which part of the sprite sheet we're drawing instead of. So full names for each of the eight directions in XCOM, plus death1-3 for the dying animation, and "dead" for the corpse floor object.
(I have to find the portrait in the inventory screen at some point too and see how that chops up, because we'll need arm and head graphics for that, too.) And yes, that means I've found the corpse graphic.
Publishing the offset palettes and then getting the artist to save multiple images that way will allow us to add some haircuts to some ethnicities only. I was considering that given that european soldiers get hair colours, they might only need a few haircuts to be distributed with the game to come up with a good customisation spread, say 3, which gives you twelve options- considering you've got three other ethnicities and a max of 26 soldiers in the base game, that's halfway to allowing all soldiers to be unique right off the bat, and then hopefully I can do another three that fit each ethnicity.
If we want to use Yanks' code, that will save me a lot of image-saving, but we will probably then need to accept that every hair style will be available for every ethnicity. I'll continue on with european hair for the moment while that's settled, as his code would effectively eliminate the need for me to save additional images for ethnicity. As power armour only differs by hair cut, I'll also make different female haircuts to male ones if that's okay, and assume all Moriarty's ones are for men.
I've also found the corpse inventory graphic and unfortunately that may be a bit too detailed for me to edit convincingly, so I hope people don't mind dealing with male flat-top corpses in blonde or brown hair (depending on armour) any time they want to drag their buddies home for a decent burial. I could probably do this for some of the easier hairstyle changes, but making the unarmoured one look convincingly female and still ragdoll-dead was a bit beyond my skillset, and it just seems weird to have different male haircuts and haircolours for corpses, but not to have any female corpses at all.
What I might do is make a variant without blood to use for unconscious soldiers at the very least.
By the by, completing hair colours for the default colours has a snag. The default hair is blonde for no armour. but brown for personal armour- when this gets patched in the code is going to need an exception for male hair colours of the default flat-top haircut so that personal armour uses new graphics for blonde men, and unarmoured men use new graphics for brown hair, but not vice-versa. edit: I suppose I could always just copy in the full spritesets and the default male sprites can get overidden with this change.
Oh, and because I've got all the female haircolours finished, here's a preview...