Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme support added #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 42 additions & 105 deletions DarkUI/Config/Colors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,111 +2,48 @@

namespace DarkUI.Config
{
public sealed class Colors
public class Colors
{
public static Color GreyBackground
{
get { return Color.FromArgb(60, 63, 65); }
}

public static Color HeaderBackground
{
get { return Color.FromArgb(57, 60, 62); }
}

public static Color BlueBackground
{
get { return Color.FromArgb(66, 77, 95); }
}

public static Color DarkBlueBackground
{
get { return Color.FromArgb(52, 57, 66); }
}

public static Color DarkBackground
{
get { return Color.FromArgb(43, 43, 43); }
}

public static Color MediumBackground
{
get { return Color.FromArgb(49, 51, 53); }
}

public static Color LightBackground
{
get { return Color.FromArgb(69, 73, 74); }
}

public static Color LighterBackground
{
get { return Color.FromArgb(95, 101, 102); }
}

public static Color LightestBackground
{
get { return Color.FromArgb(178, 178, 178); }
}

public static Color LightBorder
{
get { return Color.FromArgb(81, 81, 81); }
}

public static Color DarkBorder
{
get { return Color.FromArgb(51, 51, 51); }
}

public static Color LightText
{
get { return Color.FromArgb(220, 220, 220); }
}

public static Color DisabledText
{
get { return Color.FromArgb(153, 153, 153); }
}

public static Color BlueHighlight
{
get { return Color.FromArgb(104, 151, 187); }
}

public static Color BlueSelection
{
get { return Color.FromArgb(75, 110, 175); }
}

public static Color GreyHighlight
{
get { return Color.FromArgb(122, 128, 132); }
}

public static Color GreySelection
{
get { return Color.FromArgb(92, 92, 92); }
}

public static Color DarkGreySelection
{
get { return Color.FromArgb(82, 82, 82); }
}

public static Color DarkBlueBorder
{
get { return Color.FromArgb(51, 61, 78); }
}

public static Color LightBlueBorder
{
get { return Color.FromArgb(86, 97, 114); }
}

public static Color ActiveControl
{
get { return Color.FromArgb(159, 178, 196); }
}
public Color GreyBackground { get; set; }

public Color HeaderBackground { get; set; }

public Color BlueBackground { get; set; }

public Color DarkBlueBackground { get; set; }

public Color DarkBackground { get; set; }

public Color MediumBackground { get; set; }

public Color LightBackground { get; set; }

public Color LighterBackground { get; set; }

public Color LightestBackground { get; set; }

public Color LightBorder { get; set; }

public Color DarkBorder { get; set; }

public Color LightText { get; set; }

public Color DisabledText { get; set; }

public Color BlueHighlight { get; set; }

public Color BlueSelection { get; set; }

public Color GreyHighlight { get; set; }

public Color GreySelection { get; set; }

public Color DarkGreySelection { get; set; }

public Color DarkBlueBorder { get; set; }

public Color LightBlueBorder { get; set; }

public Color ActiveControl { get; set; }
}
}
2 changes: 1 addition & 1 deletion DarkUI/Config/Consts.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace DarkUI.Config
{
public sealed class Consts
public sealed class Consts2
{
public static int Padding = 10;

Expand Down
47 changes: 47 additions & 0 deletions DarkUI/Config/DarkTheme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Drawing;

namespace DarkUI.Config
{
public class DarkTheme : ITheme
{
public Sizes Sizes { get; } = new Sizes();

public Colors Colors { get; } = new Colors();

public DarkTheme()
{
Colors.GreyBackground = Color.FromArgb(60, 63, 65);
Colors.HeaderBackground = Color.FromArgb(57, 60, 62);
Colors.BlueBackground = Color.FromArgb(66, 77, 95);
Colors.DarkBlueBackground = Color.FromArgb(52, 57, 66);
Colors.DarkBackground = Color.FromArgb(43, 43, 43);
Colors.MediumBackground = Color.FromArgb(49, 51, 53);
Colors.LightBackground = Color.FromArgb(69, 73, 74);
Colors.LighterBackground = Color.FromArgb(95, 101, 102);
Colors.LightestBackground = Color.FromArgb(178, 178, 178);
Colors.LightBorder = Color.FromArgb(81, 81, 81);
Colors.DarkBorder = Color.FromArgb(51, 51, 51);
Colors.LightText = Color.FromArgb(220, 220, 220);
Colors.DisabledText = Color.FromArgb(153, 153, 153);
Colors.BlueHighlight = Color.FromArgb(104, 151, 187);
Colors.BlueSelection = Color.FromArgb(75, 110, 175);
Colors.GreyHighlight = Color.FromArgb(122, 128, 132);
Colors.GreySelection = Color.FromArgb(92, 92, 92);
Colors.DarkGreySelection = Color.FromArgb(82, 82, 82);
Colors.DarkBlueBorder = Color.FromArgb(51, 61, 78);
Colors.LightBlueBorder = Color.FromArgb(86, 97, 114);
Colors.ActiveControl = Color.FromArgb(159, 178, 196);

Sizes.Padding = 10;
Sizes.ScrollBarSize = 15;
Sizes.ArrowButtonSize = 15;
Sizes.MinimumThumbSize = 11;
Sizes.CheckBoxSize = 12;
Sizes.RadioButtonSize = 12;
Sizes.ToolWindowHeaderSize = 25;
Sizes.DocumentTabAreaSize = 24;
Sizes.ToolWindowTabAreaSize = 21;

}
}
}
11 changes: 11 additions & 0 deletions DarkUI/Config/ITheme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Drawing;

namespace DarkUI.Config
{
public interface ITheme
{
Sizes Sizes { get; }

Colors Colors { get; }
}
}
47 changes: 47 additions & 0 deletions DarkUI/Config/LightTheme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Drawing;

namespace DarkUI.Config
{
public class LightTheme : ITheme
{
public Sizes Sizes { get; } = new Sizes();

public Colors Colors { get; } = new Colors();

public LightTheme()
{
Colors.GreyBackground = Color.FromArgb(180, 183, 185);
Colors.HeaderBackground = Color.FromArgb(177, 180, 182);
Colors.BlueBackground = Color.FromArgb(186, 197, 215);
Colors.DarkBlueBackground = Color.FromArgb(172, 177, 186);
Colors.DarkBackground = Color.FromArgb(160, 160, 160);
Colors.MediumBackground = Color.FromArgb(169, 171, 173);
Colors.LightBackground = Color.FromArgb(189, 193, 194);
Colors.LighterBackground = Color.FromArgb(100, 101, 102);
Colors.LightestBackground = Color.FromArgb(178, 178, 178);
Colors.LightBorder = Color.FromArgb(201, 201, 201);
Colors.DarkBorder = Color.FromArgb(171, 171, 171);
Colors.LightText = Color.FromArgb(20, 20, 20);
Colors.DisabledText = Color.FromArgb(103, 103, 103);
Colors.BlueHighlight = Color.FromArgb(104, 151, 187);
Colors.BlueSelection = Color.FromArgb(75, 110, 175);
Colors.GreyHighlight = Color.FromArgb(182, 188, 182);
Colors.GreySelection = Color.FromArgb(160, 160, 160);
Colors.DarkGreySelection = Color.FromArgb(202, 202, 202);
Colors.DarkBlueBorder = Color.FromArgb(171, 181, 198);
Colors.LightBlueBorder = Color.FromArgb(206, 217, 114);
Colors.ActiveControl = Color.FromArgb(159, 178, 196);

Sizes.Padding = 10;
Sizes.ScrollBarSize = 15;
Sizes.ArrowButtonSize = 15;
Sizes.MinimumThumbSize = 11;
Sizes.CheckBoxSize = 12;
Sizes.RadioButtonSize = 12;
Sizes.ToolWindowHeaderSize = 25;
Sizes.DocumentTabAreaSize = 24;
Sizes.ToolWindowTabAreaSize = 21;

}
}
}
18 changes: 18 additions & 0 deletions DarkUI/Config/Sizes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace DarkUI.Config
{
public class Sizes
{
public int Padding { get; set; } = 10;

public int ScrollBarSize { get; set; } = 15;
public int ArrowButtonSize { get; set; } = 15;
public int MinimumThumbSize { get; set; } = 11;

public int CheckBoxSize { get; set; } = 12;
public int RadioButtonSize { get; set; } = 12;

public int ToolWindowHeaderSize { get; set; } = 25;
public int DocumentTabAreaSize { get; set; } = 24;
public int ToolWindowTabAreaSize { get; set; } = 21;
}
}
21 changes: 21 additions & 0 deletions DarkUI/Config/ThemeProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace DarkUI.Config
{
public class ThemeProvider
{
private static ITheme theme;
public static ITheme Theme
{
get
{
if (theme == null)
theme = new DarkTheme();

return theme;
}
set
{
theme = value;
}
}
}
}
26 changes: 13 additions & 13 deletions DarkUI/Controls/DarkButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public class DarkButton : Button
private bool _isDefault;
private bool _spacePressed;

private int _padding = Consts.Padding / 2;
private int _imagePadding = 5; // Consts.Padding / 2
private int _padding = ThemeProvider.Theme.Sizes.Padding / 2;
private int _imagePadding = 5; // ThemeProvider.Theme.Sizes.Padding / 2

#endregion

Expand Down Expand Up @@ -309,24 +309,24 @@ protected override void OnPaint(PaintEventArgs e)
var g = e.Graphics;
var rect = new Rectangle(0, 0, ClientSize.Width, ClientSize.Height);

var textColor = Colors.LightText;
var borderColor = Colors.GreySelection;
var fillColor = _isDefault ? Colors.DarkBlueBackground : Colors.LightBackground;
var textColor = ThemeProvider.Theme.Colors.LightText;
var borderColor = ThemeProvider.Theme.Colors.GreySelection;
var fillColor = _isDefault ? ThemeProvider.Theme.Colors.DarkBlueBackground : ThemeProvider.Theme.Colors.LightBackground;

if (Enabled)
{
if (ButtonStyle == DarkButtonStyle.Normal)
{
if (Focused && TabStop)
borderColor = Colors.BlueHighlight;
borderColor = ThemeProvider.Theme.Colors.BlueHighlight;

switch (ButtonState)
{
case DarkControlState.Hover:
fillColor = _isDefault ? Colors.BlueBackground : Colors.LighterBackground;
fillColor = _isDefault ? ThemeProvider.Theme.Colors.BlueBackground : ThemeProvider.Theme.Colors.LighterBackground;
break;
case DarkControlState.Pressed:
fillColor = _isDefault ? Colors.DarkBackground : Colors.DarkBackground;
fillColor = _isDefault ? ThemeProvider.Theme.Colors.DarkBackground : ThemeProvider.Theme.Colors.DarkBackground;
break;
}
}
Expand All @@ -335,21 +335,21 @@ protected override void OnPaint(PaintEventArgs e)
switch (ButtonState)
{
case DarkControlState.Normal:
fillColor = Colors.GreyBackground;
fillColor = ThemeProvider.Theme.Colors.GreyBackground;
break;
case DarkControlState.Hover:
fillColor = Colors.MediumBackground;
fillColor = ThemeProvider.Theme.Colors.MediumBackground;
break;
case DarkControlState.Pressed:
fillColor = Colors.DarkBackground;
fillColor = ThemeProvider.Theme.Colors.DarkBackground;
break;
}
}
}
else
{
textColor = Colors.DisabledText;
fillColor = Colors.DarkGreySelection;
textColor = ThemeProvider.Theme.Colors.DisabledText;
fillColor = ThemeProvider.Theme.Colors.DarkGreySelection;
}

using (var b = new SolidBrush(fillColor))
Expand Down
Loading