Skip to content

Commit

Permalink
Custom aura colors will be saved to config
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Dec 18, 2023
1 parent d179fe6 commit 62f280b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions app/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -604,16 +604,7 @@ private void LabelCPUFan_Click(object? sender, EventArgs e)

private void PictureColor2_Click(object? sender, EventArgs e)
{

ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = true;
colorDlg.Color = pictureColor2.BackColor;

if (colorDlg.ShowDialog() == DialogResult.OK)
{
AppConfig.Set("aura_color2", colorDlg.Color.ToArgb());
SetAura();
}
SetColorPicker("aura_color2");
}

private void PictureColor_Click(object? sender, EventArgs e)
Expand Down Expand Up @@ -681,20 +672,31 @@ private void ButtonFans_Click(object? sender, EventArgs e)
FansToggle();
}

private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
private void SetColorPicker(string colorField = "aura_color")
{

ColorDialog colorDlg = new ColorDialog();
colorDlg.AllowFullOpen = true;
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)
{
AppConfig.Set("aura_color", colorDlg.Color.ToArgb());
AppConfig.Set("aura_color_custom", string.Join("-", colorDlg.CustomColors));
AppConfig.Set(colorField, colorDlg.Color.ToArgb());
SetAura();
}
}

private void ButtonKeyboardColor_Click(object? sender, EventArgs e)
{
SetColorPicker("aura_color");
}

public void InitAura()
{
Aura.Mode = (AuraMode)AppConfig.Get("aura_mode");
Expand Down

0 comments on commit 62f280b

Please sign in to comment.