public Dialog_AlienFaceStyling(CompFace face, ThingDef_AlienRace alienProp) : base(face)
        {
            Pawn = face.Pawn;
            PawnColorUtils.InitializeColors();
            this.alienRace = ProviderAlienRaces.GetAlienRace(alienProp, Pawn);
            AlienRace race = this.alienRace;

            if (race != null && race.HasHair)
            {
                HairDefs = DefDatabase <HairDef> .AllDefsListForReading.FindAll(
                    x =>
                    x.hairTags
                    .SharesElementWith(this.alienRace
                                       .HairTags) && !x.IsBeardNotHair());

                CurrentFilter = race.HairTags;
            }

            this.useSkincolorForHair = ((ThingDef_AlienRace)this.CompFace.Pawn.def)
                                       .alienRace.generalSettings.alienPartGenerator
                                       .useSkincolorForHair;
            this.genderTab = GenderTab.All;
        }
        protected void DrawHumanlikeColorSelector(float cursorY)
        {
            int   currentSwatchIndex = PawnColorUtils.GetLeftIndexForValue(this.NewMelanin);
            Color currentSwatchColor = PawnColorUtils.Colors[currentSwatchIndex];

            Rect swatchRect = new Rect(SwatchPosition.x, cursorY, SwatchSize.x, SwatchSize.y);

            // Draw the swatch selection boxes.
            int colorCount   = PawnColorUtils.Colors.Length - 1;
            int clickedIndex = -1;

            for (int i = 0; i < colorCount; i++)
            {
                Color color = PawnColorUtils.Colors[i];

                // If the swatch is selected, draw a heavier border around it.
                bool isThisSwatchSelected = (i == currentSwatchIndex);
                if (isThisSwatchSelected)
                {
                    Rect selectionRect =
                        new Rect(swatchRect.x - 2, swatchRect.y - 2, SwatchSize.x + 4, SwatchSize.y + 4);
                    GUI.color = ColorSwatchSelection;
                    GUI.DrawTexture(selectionRect, BaseContent.WhiteTex);
                }

                // Draw the border around the swatch.
                Rect borderRect = new Rect(swatchRect.x - 1, swatchRect.y - 1, SwatchSize.x + 2, SwatchSize.y + 2);
                GUI.color = ColorSwatchBorder;
                GUI.DrawTexture(borderRect, BaseContent.WhiteTex);

                // Draw the swatch itself.
                GUI.color = color;
                GUI.DrawTexture(swatchRect, BaseContent.WhiteTex);

                if (!isThisSwatchSelected)
                {
                    if (Widgets.ButtonInvisible(swatchRect, false))
                    {
                        clickedIndex = i;
                        //currentSwatchColor = color;
                    }
                }

                // Advance the swatch rect cursor position and wrap it if necessary.
                swatchRect.x += SwatchSpacing.x;
                if (swatchRect.x >= SwatchLimit - SwatchSize.x)
                {
                    swatchRect.y += SwatchSpacing.y;
                    swatchRect.x  = SwatchPosition.x;
                }
            }

            // Draw the current color box.
            GUI.color = Color.white;
            Rect currentColorRect = new Rect(SwatchPosition.x, swatchRect.y + 4, 49, 49);

            if (swatchRect.x != SwatchPosition.x)
            {
                currentColorRect.y += SwatchSpacing.y;
            }

            GUI.color = ColorSwatchBorder;
            GUI.DrawTexture(currentColorRect, BaseContent.WhiteTex);
            GUI.color = Pawn.story.SkinColor;
            GUI.DrawTexture(currentColorRect.ContractedBy(1), BaseContent.WhiteTex);
            GUI.color = Color.white;

            // Figure out the lerp value so that we can draw the slider.
            float minValue = 0.00f;
            float maxValue = 0.99f;
            float t        = PawnColorUtils.GetRelativeLerpValue(this.NewMelanin);

            if (t < minValue)
            {
                t = minValue;
            }
            else if (t > maxValue)
            {
                t = maxValue;
            }

            if (clickedIndex != -1)
            {
                t = minValue;
            }

            // Draw the slider.
            float newValue = GUI.HorizontalSlider(new Rect(currentColorRect.x + 56, currentColorRect.y + 18, 136, 16),
                                                  t, minValue, 1);

            if (newValue < minValue)
            {
                newValue = minValue;
            }
            else if (newValue > maxValue)
            {
                newValue = maxValue;
            }

            GUI.color = Color.white;

            // If the user selected a new swatch or changed the lerp value, set a new color value.
            if (t != newValue || clickedIndex != -1)
            {
                if (clickedIndex != -1)
                {
                    currentSwatchIndex = clickedIndex;
                }

                float melaninLevel = PawnColorUtils.GetValueFromRelativeLerp(currentSwatchIndex, newValue);
                this.NewMelanin   = melaninLevel;
                this.RerenderPawn = true;
            }
        }