private void AddPalette(string errorMsg = null, string oldVal = null) => K45DialogControl.ShowModalPromptText(new K45DialogControl.BindProperties
 {
     title   = Locale.Get("K45_TLM_ADDPALETTE"),
     message = (errorMsg + "\n").TrimToNull() + Locale.Get("K45_TLM_ADDPALETTE_PROMPTNAME"),
     defaultTextFieldContent = oldVal,
     showButton1             = true,
     textButton1             = Locale.Get("EXCEPTION_OK"),
     textButton2             = Locale.Get("CANCEL"),
     showButton2             = true
 }, (x, val) =>
 {
     if (x == 1)
     {
         if (val == TLMAutoColorPaletteContainer.PALETTE_RANDOM || !(TLMAutoColorPaletteContainer.GetPalette(val) is null))
         {
             AddPalette(Locale.Get("K45_TLM_ADDPALETTE_ERROR_PALETTEALREADYEXISTS"), val);
         }
         else if (val.IsNullOrWhiteSpace())
         {
             AddPalette(Locale.Get("K45_TLM_ADDPALETTE_ERROR_INVALIDNAME"), val);
         }
         TLMAutoColorPaletteContainer.AddPalette(val);
         TLMAutoColorPaletteContainer.Save(val);
         ReloadData();
         m_paletteSelect.selectedValue = val;
     }
     return(true);
 });
        private IEnumerator SavePalette(string paletteName)
        {
            if (!canEdit)
            {
                yield break;
            }

            if (framesCooldownSave > 0)
            {
                framesCooldownSave = 3;
                yield break;
            }
            framesCooldownSave = 3;
            do
            {
                yield return(null);

                framesCooldownSave--;
            } while (framesCooldownSave > 0);

            TLMAutoColorPaletteContainer.Save(paletteName);
            UpdateColorList(TLMAutoColorPaletteContainer.GetColors(paletteName));
        }