Custom aura colors will be saved to config

This commit is contained in:
Serge
2023-12-18 17:39:58 +01:00
parent d179fe6b86
commit 62f280b0b9

View File

@@ -604,16 +604,7 @@ namespace GHelper
private void PictureColor2_Click(object? sender, EventArgs e) private void PictureColor2_Click(object? sender, EventArgs e)
{ {
SetColorPicker("aura_color2");
ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = true;
colorDlg.Color = pictureColor2.BackColor;
if (colorDlg.ShowDialog() == DialogResult.OK)
{
AppConfig.Set("aura_color2", colorDlg.Color.ToArgb());
SetAura();
}
} }
private void PictureColor_Click(object? sender, EventArgs e) private void PictureColor_Click(object? sender, EventArgs e)
@@ -681,20 +672,31 @@ namespace GHelper
FansToggle(); FansToggle();
} }
private void ButtonKeyboardColor_Click(object? sender, EventArgs e) private void SetColorPicker(string colorField = "aura_color")
{ {
ColorDialog colorDlg = new ColorDialog(); ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = true; colorDlg.AllowFullOpen = true;
colorDlg.Color = pictureColor.BackColor; colorDlg.Color = pictureColor.BackColor;
try
{
colorDlg.CustomColors = AppConfig.GetString("aura_color_custom", "").Split('-').Select(int.Parse).ToArray();
}
catch (Exception ex) { }
if (colorDlg.ShowDialog() == DialogResult.OK) if (colorDlg.ShowDialog() == DialogResult.OK)
{ {
AppConfig.Set("aura_color", colorDlg.Color.ToArgb()); AppConfig.Set("aura_color_custom", string.Join("-", colorDlg.CustomColors));
AppConfig.Set(colorField, colorDlg.Color.ToArgb());
SetAura(); SetAura();
} }
} }
private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
{
SetColorPicker("aura_color");
}
public void InitAura() public void InitAura()
{ {
Aura.Mode = (AuraMode)AppConfig.Get("aura_mode"); Aura.Mode = (AuraMode)AppConfig.Get("aura_mode");