private bool SetHue(Control ctrl, string cfg) { HueEntry h = new HueEntry(RazorEnhanced.Settings.General.ReadInt(cfg)); if (h.ShowDialog(this) == DialogResult.OK) { int hueIdx = h.Hue; RazorEnhanced.Settings.General.WriteInt(cfg, hueIdx); switch (cfg) { case "SysColor": SysColor = hueIdx; break; case "WarningColor": WarningColor = hueIdx; break; case "SpeechHue": SpeechHue = hueIdx; break; case "LTHilight": LTHilight = hueIdx; break; case "BeneficialSpellHue": BeneficialSpellHue = hueIdx; break; case "HarmfulSpellHue": HarmfulSpellHue = hueIdx; break; case "NeutralSpellHue": NeutralSpellHue = hueIdx; break; } if (hueIdx > 0 && hueIdx < 3000) { ctrl.BackColor = Ultima.Hues.GetHue(hueIdx - 1).GetColor(HueEntry.TextHueIDX); } else { ctrl.BackColor = System.Drawing.Color.White; } ctrl.ForeColor = (ctrl.BackColor.GetBrightness() < 0.35 ? System.Drawing.Color.White : System.Drawing.Color.Black); return(true); } else { return(false); } }
private bool SetHue( Control ctrl, string cfg ) { HueEntry h = new HueEntry( Config.GetInt( cfg ) ); if ( h.ShowDialog( this ) == DialogResult.OK ) { int hueIdx = h.Hue; Config.SetProperty( cfg, hueIdx ); if ( hueIdx > 0 && hueIdx < 3000 ) ctrl.BackColor = Ultima.Hues.GetHue( hueIdx - 1 ).GetColor( HueEntry.TextHueIDX ); else ctrl.BackColor = Color.White; ctrl.ForeColor = ( ctrl.BackColor.GetBrightness() < 0.35 ? Color.White : Color.Black ); return true; } else { return false; } }