* 重构主题配色代码

This commit is contained in:
Sunny 2022-03-22 10:13:02 +08:00
parent 519f5e9e09
commit 88beccca72
5 changed files with 52 additions and 47 deletions

Binary file not shown.

Binary file not shown.

View File

@ -44,7 +44,6 @@ namespace Sunny.UI.Demo
// //
this.uiLabel3.AutoSize = true; this.uiLabel3.AutoSize = true;
this.uiLabel3.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLabel3.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLabel3.IsScaled = false;
this.uiLabel3.Location = new System.Drawing.Point(31, 136); this.uiLabel3.Location = new System.Drawing.Point(31, 136);
this.uiLabel3.Name = "uiLabel3"; this.uiLabel3.Name = "uiLabel3";
this.uiLabel3.Size = new System.Drawing.Size(138, 21); this.uiLabel3.Size = new System.Drawing.Size(138, 21);
@ -56,7 +55,6 @@ namespace Sunny.UI.Demo
// //
this.uiLabel2.AutoSize = true; this.uiLabel2.AutoSize = true;
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLabel2.IsScaled = false;
this.uiLabel2.Location = new System.Drawing.Point(211, 95); this.uiLabel2.Location = new System.Drawing.Point(211, 95);
this.uiLabel2.Name = "uiLabel2"; this.uiLabel2.Name = "uiLabel2";
this.uiLabel2.Size = new System.Drawing.Size(138, 21); this.uiLabel2.Size = new System.Drawing.Size(138, 21);
@ -68,7 +66,6 @@ namespace Sunny.UI.Demo
// //
this.uiLabel1.AutoSize = true; this.uiLabel1.AutoSize = true;
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLabel1.IsScaled = false;
this.uiLabel1.Location = new System.Drawing.Point(31, 95); this.uiLabel1.Location = new System.Drawing.Point(31, 95);
this.uiLabel1.Name = "uiLabel1"; this.uiLabel1.Name = "uiLabel1";
this.uiLabel1.Size = new System.Drawing.Size(138, 21); this.uiLabel1.Size = new System.Drawing.Size(138, 21);
@ -80,7 +77,6 @@ namespace Sunny.UI.Demo
// uiLine7 // uiLine7
// //
this.uiLine7.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLine7.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine7.IsScaled = false;
this.uiLine7.Location = new System.Drawing.Point(30, 55); this.uiLine7.Location = new System.Drawing.Point(30, 55);
this.uiLine7.MinimumSize = new System.Drawing.Size(16, 16); this.uiLine7.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine7.Name = "uiLine7"; this.uiLine7.Name = "uiLine7";
@ -92,10 +88,7 @@ namespace Sunny.UI.Demo
// uiScrollingText2 // uiScrollingText2
// //
this.uiScrollingText2.Active = true; this.uiScrollingText2.Active = true;
this.uiScrollingText2.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiScrollingText2.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.uiScrollingText2.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.uiScrollingText2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(80)))), ((int)(((byte)(160)))), ((int)(((byte)(255)))));
this.uiScrollingText2.IsScaled = false;
this.uiScrollingText2.Location = new System.Drawing.Point(381, 129); this.uiScrollingText2.Location = new System.Drawing.Point(381, 129);
this.uiScrollingText2.MinimumSize = new System.Drawing.Size(1, 1); this.uiScrollingText2.MinimumSize = new System.Drawing.Size(1, 1);
this.uiScrollingText2.Name = "uiScrollingText2"; this.uiScrollingText2.Name = "uiScrollingText2";
@ -109,7 +102,6 @@ namespace Sunny.UI.Demo
this.uiScrollingText1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255))))); this.uiScrollingText1.FillColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(243)))), ((int)(((byte)(255)))));
this.uiScrollingText1.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiScrollingText1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiScrollingText1.ForeColor = System.Drawing.Color.Red; this.uiScrollingText1.ForeColor = System.Drawing.Color.Red;
this.uiScrollingText1.IsScaled = false;
this.uiScrollingText1.Location = new System.Drawing.Point(381, 88); this.uiScrollingText1.Location = new System.Drawing.Point(381, 88);
this.uiScrollingText1.MinimumSize = new System.Drawing.Size(1, 1); this.uiScrollingText1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiScrollingText1.Name = "uiScrollingText1"; this.uiScrollingText1.Name = "uiScrollingText1";
@ -123,7 +115,6 @@ namespace Sunny.UI.Demo
// uiLine6 // uiLine6
// //
this.uiLine6.Font = new System.Drawing.Font("微软雅黑", 12F); this.uiLine6.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine6.IsScaled = false;
this.uiLine6.Location = new System.Drawing.Point(381, 55); this.uiLine6.Location = new System.Drawing.Point(381, 55);
this.uiLine6.MinimumSize = new System.Drawing.Size(16, 16); this.uiLine6.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine6.Name = "uiLine6"; this.uiLine6.Name = "uiLine6";

View File

@ -642,6 +642,11 @@ namespace Sunny.UI
/// 其他颜色 /// 其他颜色
/// </summary> /// </summary>
public static readonly Color Plain = Color.Silver; public static readonly Color Plain = Color.Silver;
/// <summary>
/// 白色
/// </summary>
public static readonly Color White = Color.FromArgb(248, 248, 248);
} }
/// <summary> /// <summary>

View File

@ -220,13 +220,16 @@ namespace Sunny.UI
public virtual Color FlowLayoutPanelBarFillColor { get; protected set; } public virtual Color FlowLayoutPanelBarFillColor { get; protected set; }
public virtual Color FlowLayoutPanelBarForeColor { get; protected set; } public virtual Color FlowLayoutPanelBarForeColor { get; protected set; }
protected virtual void Init(Color color, UIStyle style, Color foreColor) protected Color ForeColor { get; set; }
protected virtual void Init(Color color, UIStyle style, Color reverseColor, Color foreColor)
{ {
Name = style; Name = style;
FillDisableColor = Color.FromArgb(244, 244, 244); FillDisableColor = Color.FromArgb(244, 244, 244);
RectDisableColor = Color.FromArgb(173, 178, 181); RectDisableColor = Color.FromArgb(173, 178, 181);
ForeDisableColor = Color.FromArgb(109, 109, 103); ForeDisableColor = Color.FromArgb(109, 109, 103);
ForeColor = foreColor;
PrimaryColor = color; PrimaryColor = color;
RectColor = color; RectColor = color;
@ -238,31 +241,31 @@ namespace Sunny.UI
RegularColor = colors[10]; RegularColor = colors[10];
GridSelectedColor = colors[3]; GridSelectedColor = colors[3];
GridSelectedForeColor = UIFontColor.Primary; GridSelectedForeColor = foreColor;
GridStripeEvenColor = Color.White; GridStripeEvenColor = colors[0];
GridStripeOddColor = PlainColor; GridStripeOddColor = PlainColor;
GridLineColor = PrimaryColor; GridLineColor = colors[13];
GridTitleColor = PrimaryColor; GridTitleColor = PrimaryColor;
GridTitleForeColor = foreColor; GridTitleForeColor = reverseColor;
GridForeColor = UIFontColor.Primary; GridForeColor = foreColor;
GridBarFillColor = PlainColor; GridBarFillColor = PlainColor;
GridBarForeColor = PrimaryColor; GridBarForeColor = PrimaryColor;
FormTitleColor = PrimaryColor; FormTitleColor = PrimaryColor;
FormTitleForeColor = foreColor; FormTitleForeColor = reverseColor;
FormForeColor = UIFontColor.Primary; FormForeColor = foreColor;
FormRectColor = PrimaryColor; FormRectColor = PrimaryColor;
FormControlBoxFillHoverColor = colors[12]; FormControlBoxFillHoverColor = colors[12];
FormControlBoxCloseFillHoverColor = UIColor.Red; FormControlBoxCloseFillHoverColor = UIColor.Red;
FormBackColor = PlainColor; FormBackColor = PlainColor;
FormControlBoxForeColor = Color.White; FormControlBoxForeColor = Color.White;
PanelForeColor = UIFontColor.Primary; PanelForeColor = foreColor;
PanelRectColor = PrimaryColor; PanelRectColor = PrimaryColor;
PanelFillColor = PlainColor; PanelFillColor = PlainColor;
PanelFillColor2 = PlainColor; PanelFillColor2 = PlainColor;
PanelTitleColor = PrimaryColor; PanelTitleColor = PrimaryColor;
PanelTitleForeColor = foreColor; PanelTitleForeColor = reverseColor;
ButtonFillColor = PrimaryColor; ButtonFillColor = PrimaryColor;
ButtonFillHoverColor = colors[12]; ButtonFillHoverColor = colors[12];
@ -270,10 +273,10 @@ namespace Sunny.UI
ButtonFillSelectedColor = colors1[3]; ButtonFillSelectedColor = colors1[3];
ButtonFillColor2 = ButtonFillColor; ButtonFillColor2 = ButtonFillColor;
ButtonForeColor = foreColor; ButtonForeColor = reverseColor;
ButtonForeHoverColor = foreColor; ButtonForeHoverColor = reverseColor;
ButtonForePressColor = foreColor; ButtonForePressColor = reverseColor;
ButtonForeSelectedColor = foreColor; ButtonForeSelectedColor = reverseColor;
ButtonRectColor = PrimaryColor; ButtonRectColor = PrimaryColor;
ButtonRectHoverColor = colors[12]; ButtonRectHoverColor = colors[12];
@ -287,15 +290,15 @@ namespace Sunny.UI
AvatarFillColor = Color.Silver; AvatarFillColor = Color.Silver;
AvatarForeColor = PrimaryColor; AvatarForeColor = PrimaryColor;
ImageButtonForeColor = UIFontColor.Primary; ImageButtonForeColor = foreColor;
CheckBoxColor = PrimaryColor; CheckBoxColor = PrimaryColor;
CheckBoxForeColor = UIFontColor.Primary; CheckBoxForeColor = foreColor;
LogoForeColor = UIFontColor.Primary; LogoForeColor = foreColor;
LogoFillColor = PrimaryColor; LogoFillColor = PrimaryColor;
LineForeColor = UIFontColor.Primary; LineForeColor = foreColor;
LineFillColor = PlainColor; LineFillColor = PlainColor;
LineRectColor = PrimaryColor; LineRectColor = PrimaryColor;
@ -309,17 +312,17 @@ namespace Sunny.UI
SwitchFillColor = Color.White; SwitchFillColor = Color.White;
SwitchRectDisableColor = RectDisableColor; SwitchRectDisableColor = RectDisableColor;
LabelForeColor = UIFontColor.Primary; LabelForeColor = foreColor;
LabelRotateFrameColor = ButtonRectColor; LabelRotateFrameColor = ButtonRectColor;
LabelRotateForeColor = UIFontColor.Primary; LabelRotateForeColor = foreColor;
ColorWheelFrameColor = ButtonRectColor; ColorWheelFrameColor = ButtonRectColor;
ColorWheelBackColor = PlainColor; ColorWheelBackColor = PlainColor;
ContextMenuColor = PlainColor; ContextMenuColor = PlainColor;
ContextMenuSelectedColor = PrimaryColor; ContextMenuSelectedColor = PrimaryColor;
ContextMenuForeColor = UIFontColor.Primary; ContextMenuForeColor = foreColor;
ScrollBarFillColor = PlainColor; ScrollBarFillColor = PlainColor;
ScrollBarForeColor = PrimaryColor; ScrollBarForeColor = PrimaryColor;
@ -341,7 +344,7 @@ namespace Sunny.UI
PageBackColor = PlainColor; PageBackColor = PlainColor;
PageRectColor = PrimaryColor; PageRectColor = PrimaryColor;
PageForeColor = UIFontColor.Primary; PageForeColor = foreColor;
PageTitleFillColor = Color.FromArgb(76, 76, 76); PageTitleFillColor = Color.FromArgb(76, 76, 76);
PageTitleForeColor = Color.White; PageTitleForeColor = Color.White;
@ -352,7 +355,7 @@ namespace Sunny.UI
TabControlTabSelectedColor = PrimaryColor; TabControlTabSelectedColor = PrimaryColor;
TabControlBackColor = PlainColor; TabControlBackColor = PlainColor;
DropDownControlColor = UIFontColor.Primary; DropDownControlColor = foreColor;
ListItemSelectBackColor = PrimaryColor; ListItemSelectBackColor = PrimaryColor;
ListItemSelectForeColor = PlainColor; ListItemSelectForeColor = PlainColor;
@ -360,21 +363,21 @@ namespace Sunny.UI
ListBarFillColor = PlainColor; ListBarFillColor = PlainColor;
ListBarForeColor = PrimaryColor; ListBarForeColor = PrimaryColor;
ListBackColor = Color.White; ListBackColor = Color.White;
ListForeColor = UIFontColor.Primary; ListForeColor = foreColor;
TreeViewSelectedColor = PrimaryColor; TreeViewSelectedColor = PrimaryColor;
TreeViewHoverColor = colors[3]; TreeViewHoverColor = colors[3];
TreeViewBarFillColor = PlainColor; TreeViewBarFillColor = PlainColor;
TreeViewBarForeColor = PrimaryColor; TreeViewBarForeColor = PrimaryColor;
TreeViewForeColor = UIFontColor.Primary; TreeViewForeColor = foreColor;
TreeViewBackColor = Color.White; TreeViewBackColor = Color.White;
TreeViewLineColor = UIFontColor.Primary; TreeViewLineColor = foreColor;
EditorBackColor = UIColor.White; EditorBackColor = UIColor.White;
NavMenuMenuSelectedColor = PrimaryColor; NavMenuMenuSelectedColor = PrimaryColor;
DataGridViewFooterForeColor = UIFontColor.Primary; DataGridViewFooterForeColor = foreColor;
PaginationForeColor = PrimaryColor; PaginationForeColor = PrimaryColor;
@ -398,7 +401,7 @@ namespace Sunny.UI
{ {
public UIPurpleStyle() public UIPurpleStyle()
{ {
base.Init(UIColor.Purple, UIStyle.Purple, Color.White); base.Init(UIColor.Purple, UIStyle.Purple, Color.White, UIFontColor.Primary);
} }
} }
@ -406,12 +409,12 @@ namespace Sunny.UI
{ {
public UIColorfulStyle() public UIColorfulStyle()
{ {
base.Init(Color.FromArgb(0, 190, 172), UIStyle.Colorful, Color.White); base.Init(Color.FromArgb(0, 190, 172), UIStyle.Colorful, Color.White, UIFontColor.Primary);
} }
public void Init(Color styleColor, Color foreColor) public void Init(Color styleColor, Color foreColor)
{ {
Init(styleColor, UIStyle.Colorful, foreColor); Init(styleColor, UIStyle.Colorful, foreColor, UIFontColor.Primary);
} }
} }
@ -424,7 +427,7 @@ namespace Sunny.UI
{ {
public UIBlueStyle() public UIBlueStyle()
{ {
base.Init(UIColor.Blue, UIStyle.Blue, Color.White); base.Init(UIColor.Blue, UIStyle.Blue, Color.White, UIFontColor.Primary);
} }
} }
@ -432,7 +435,7 @@ namespace Sunny.UI
{ {
public UIGreenStyle() public UIGreenStyle()
{ {
base.Init(UIColor.Green, UIStyle.Green, Color.White); base.Init(UIColor.Green, UIStyle.Green, Color.White, UIFontColor.Primary);
} }
} }
@ -440,7 +443,7 @@ namespace Sunny.UI
{ {
public UIRedStyle() public UIRedStyle()
{ {
base.Init(UIColor.Red, UIStyle.Red, Color.White); base.Init(UIColor.Red, UIStyle.Red, Color.White, UIFontColor.Primary);
} }
} }
@ -448,7 +451,7 @@ namespace Sunny.UI
{ {
public UIOrangeStyle() public UIOrangeStyle()
{ {
base.Init(UIColor.Orange, UIStyle.Orange, Color.White); base.Init(UIColor.Orange, UIStyle.Orange, Color.White, UIFontColor.Primary);
} }
} }
@ -456,7 +459,7 @@ namespace Sunny.UI
{ {
public UIGrayStyle() public UIGrayStyle()
{ {
base.Init(UIColor.Gray, UIStyle.Gray, Color.White); base.Init(UIColor.Gray, UIStyle.Gray, Color.White, UIFontColor.Primary);
} }
} }
@ -464,7 +467,7 @@ namespace Sunny.UI
{ {
public UIWhiteStyle() public UIWhiteStyle()
{ {
base.Init(UIColor.White, UIStyle.White, Color.Black); base.Init(UIColor.White, UIStyle.White, Color.Black, UIFontColor.Primary);
} }
} }
@ -472,7 +475,7 @@ namespace Sunny.UI
{ {
public UIDarkBlueStyle() public UIDarkBlueStyle()
{ {
base.Init(UIColor.Blue, UIStyle.DarkBlue, Color.White); base.Init(UIColor.Blue, UIStyle.DarkBlue, Color.White, UIFontColor.White);
PrimaryColor = UIColor.DarkBlue; PrimaryColor = UIColor.DarkBlue;
RectColor = Color.FromArgb(18, 58, 92); RectColor = Color.FromArgb(18, 58, 92);
@ -566,6 +569,11 @@ namespace Sunny.UI
ScrollBarFillColor = PlainColor; ScrollBarFillColor = PlainColor;
ScrollBarForeColor = ForeColor; ScrollBarForeColor = ForeColor;
ScrollingTextFillColor = PlainColor;
ScrollingTextForeColor = ForeColor;
LogoForeColor = UIFontColor.Primary;
} }
} }
@ -573,7 +581,8 @@ namespace Sunny.UI
{ {
public UIBlackStyle() public UIBlackStyle()
{ {
base.Init(UIColor.Black, UIStyle.Black, Color.White); base.Init(UIColor.Black, UIStyle.Black, Color.White, UIFontColor.Primary);
ContextMenuForeColor = Color.FromArgb(80, 80, 80);
} }
} }
} }