-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
288 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Windows.Forms; | ||
|
||
namespace Naticord.Classes | ||
{ | ||
internal class DarkMode | ||
{ | ||
private readonly Color darkBackgroundColor = Color.FromArgb(30, 30, 30); | ||
private readonly Color darkTextColor = Color.White; | ||
private readonly Color darkButtonColor = Color.FromArgb(45, 45, 48); | ||
private readonly Color darkButtonTextColor = Color.White; | ||
|
||
public void ApplyDarkMode(Control control) | ||
{ | ||
foreach (Control childControl in control.Controls) | ||
{ | ||
ApplyControlStyles(childControl); | ||
|
||
if (childControl.HasChildren) | ||
{ | ||
ApplyDarkMode(childControl); | ||
} | ||
} | ||
} | ||
|
||
private void ApplyControlStyles(Control control) | ||
{ | ||
if (control is Button) | ||
{ | ||
ApplyButtonStyle(control as Button); | ||
} | ||
else if (control is Label) | ||
{ | ||
ApplyLabelStyle(control as Label); | ||
} | ||
else if (control is TextBox) | ||
{ | ||
ApplyTextBoxStyle(control as TextBox); | ||
} | ||
else | ||
{ | ||
control.BackColor = darkBackgroundColor; | ||
control.ForeColor = darkTextColor; | ||
} | ||
} | ||
|
||
private void ApplyButtonStyle(Button button) | ||
{ | ||
button.BackColor = darkButtonColor; | ||
button.ForeColor = darkButtonTextColor; | ||
button.FlatStyle = FlatStyle.Flat; | ||
button.FlatAppearance.BorderColor = darkButtonColor; | ||
} | ||
|
||
private void ApplyLabelStyle(Label label) | ||
{ | ||
label.ForeColor = darkTextColor; | ||
} | ||
|
||
private void ApplyTextBoxStyle(TextBox textBox) | ||
{ | ||
textBox.BackColor = darkBackgroundColor; | ||
textBox.ForeColor = darkTextColor; | ||
textBox.BorderStyle = BorderStyle.FixedSingle; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.