How are skin colors calculated?

It’s a shame this isn’t documented.

Is it the same pattern to get available eye color, beard color, hair color, etc?