* 重构主题配色代码

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.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLabel3.IsScaled = false;
this.uiLabel3.Location = new System.Drawing.Point(31, 136);
this.uiLabel3.Name = "uiLabel3";
this.uiLabel3.Size = new System.Drawing.Size(138, 21);
@ -56,7 +55,6 @@ namespace Sunny.UI.Demo
//
this.uiLabel2.AutoSize = true;
this.uiLabel2.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLabel2.IsScaled = false;
this.uiLabel2.Location = new System.Drawing.Point(211, 95);
this.uiLabel2.Name = "uiLabel2";
this.uiLabel2.Size = new System.Drawing.Size(138, 21);
@ -68,7 +66,6 @@ namespace Sunny.UI.Demo
//
this.uiLabel1.AutoSize = true;
this.uiLabel1.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLabel1.IsScaled = false;
this.uiLabel1.Location = new System.Drawing.Point(31, 95);
this.uiLabel1.Name = "uiLabel1";
this.uiLabel1.Size = new System.Drawing.Size(138, 21);
@ -80,7 +77,6 @@ namespace Sunny.UI.Demo
// uiLine7
//
this.uiLine7.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine7.IsScaled = false;
this.uiLine7.Location = new System.Drawing.Point(30, 55);
this.uiLine7.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine7.Name = "uiLine7";
@ -92,10 +88,7 @@ namespace Sunny.UI.Demo
// uiScrollingText2
//
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.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.MinimumSize = new System.Drawing.Size(1, 1);
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.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiScrollingText1.ForeColor = System.Drawing.Color.Red;
this.uiScrollingText1.IsScaled = false;
this.uiScrollingText1.Location = new System.Drawing.Point(381, 88);
this.uiScrollingText1.MinimumSize = new System.Drawing.Size(1, 1);
this.uiScrollingText1.Name = "uiScrollingText1";
@ -123,7 +115,6 @@ namespace Sunny.UI.Demo
// uiLine6
//
this.uiLine6.Font = new System.Drawing.Font("微软雅黑", 12F);
this.uiLine6.IsScaled = false;
this.uiLine6.Location = new System.Drawing.Point(381, 55);
this.uiLine6.MinimumSize = new System.Drawing.Size(16, 16);
this.uiLine6.Name = "uiLine6";

View File

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

View File

@ -220,13 +220,16 @@ namespace Sunny.UI
public virtual Color FlowLayoutPanelBarFillColor { 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;
FillDisableColor = Color.FromArgb(244, 244, 244);
RectDisableColor = Color.FromArgb(173, 178, 181);
ForeDisableColor = Color.FromArgb(109, 109, 103);
ForeColor = foreColor;
PrimaryColor = color;
RectColor = color;
@ -238,31 +241,31 @@ namespace Sunny.UI
RegularColor = colors[10];
GridSelectedColor = colors[3];
GridSelectedForeColor = UIFontColor.Primary;
GridStripeEvenColor = Color.White;
GridSelectedForeColor = foreColor;
GridStripeEvenColor = colors[0];
GridStripeOddColor = PlainColor;
GridLineColor = PrimaryColor;
GridLineColor = colors[13];
GridTitleColor = PrimaryColor;
GridTitleForeColor = foreColor;
GridForeColor = UIFontColor.Primary;
GridTitleForeColor = reverseColor;
GridForeColor = foreColor;
GridBarFillColor = PlainColor;
GridBarForeColor = PrimaryColor;
FormTitleColor = PrimaryColor;
FormTitleForeColor = foreColor;
FormForeColor = UIFontColor.Primary;
FormTitleForeColor = reverseColor;
FormForeColor = foreColor;
FormRectColor = PrimaryColor;
FormControlBoxFillHoverColor = colors[12];
FormControlBoxCloseFillHoverColor = UIColor.Red;
FormBackColor = PlainColor;
FormControlBoxForeColor = Color.White;
PanelForeColor = UIFontColor.Primary;
PanelForeColor = foreColor;
PanelRectColor = PrimaryColor;
PanelFillColor = PlainColor;
PanelFillColor2 = PlainColor;
PanelTitleColor = PrimaryColor;
PanelTitleForeColor = foreColor;
PanelTitleForeColor = reverseColor;
ButtonFillColor = PrimaryColor;
ButtonFillHoverColor = colors[12];
@ -270,10 +273,10 @@ namespace Sunny.UI
ButtonFillSelectedColor = colors1[3];
ButtonFillColor2 = ButtonFillColor;
ButtonForeColor = foreColor;
ButtonForeHoverColor = foreColor;
ButtonForePressColor = foreColor;
ButtonForeSelectedColor = foreColor;
ButtonForeColor = reverseColor;
ButtonForeHoverColor = reverseColor;
ButtonForePressColor = reverseColor;
ButtonForeSelectedColor = reverseColor;
ButtonRectColor = PrimaryColor;
ButtonRectHoverColor = colors[12];
@ -287,15 +290,15 @@ namespace Sunny.UI
AvatarFillColor = Color.Silver;
AvatarForeColor = PrimaryColor;
ImageButtonForeColor = UIFontColor.Primary;
ImageButtonForeColor = foreColor;
CheckBoxColor = PrimaryColor;
CheckBoxForeColor = UIFontColor.Primary;
CheckBoxForeColor = foreColor;
LogoForeColor = UIFontColor.Primary;
LogoForeColor = foreColor;
LogoFillColor = PrimaryColor;
LineForeColor = UIFontColor.Primary;
LineForeColor = foreColor;
LineFillColor = PlainColor;
LineRectColor = PrimaryColor;
@ -309,17 +312,17 @@ namespace Sunny.UI
SwitchFillColor = Color.White;
SwitchRectDisableColor = RectDisableColor;
LabelForeColor = UIFontColor.Primary;
LabelForeColor = foreColor;
LabelRotateFrameColor = ButtonRectColor;
LabelRotateForeColor = UIFontColor.Primary;
LabelRotateForeColor = foreColor;
ColorWheelFrameColor = ButtonRectColor;
ColorWheelBackColor = PlainColor;
ContextMenuColor = PlainColor;
ContextMenuSelectedColor = PrimaryColor;
ContextMenuForeColor = UIFontColor.Primary;
ContextMenuForeColor = foreColor;
ScrollBarFillColor = PlainColor;
ScrollBarForeColor = PrimaryColor;
@ -341,7 +344,7 @@ namespace Sunny.UI
PageBackColor = PlainColor;
PageRectColor = PrimaryColor;
PageForeColor = UIFontColor.Primary;
PageForeColor = foreColor;
PageTitleFillColor = Color.FromArgb(76, 76, 76);
PageTitleForeColor = Color.White;
@ -352,7 +355,7 @@ namespace Sunny.UI
TabControlTabSelectedColor = PrimaryColor;
TabControlBackColor = PlainColor;
DropDownControlColor = UIFontColor.Primary;
DropDownControlColor = foreColor;
ListItemSelectBackColor = PrimaryColor;
ListItemSelectForeColor = PlainColor;
@ -360,21 +363,21 @@ namespace Sunny.UI
ListBarFillColor = PlainColor;
ListBarForeColor = PrimaryColor;
ListBackColor = Color.White;
ListForeColor = UIFontColor.Primary;
ListForeColor = foreColor;
TreeViewSelectedColor = PrimaryColor;
TreeViewHoverColor = colors[3];
TreeViewBarFillColor = PlainColor;
TreeViewBarForeColor = PrimaryColor;
TreeViewForeColor = UIFontColor.Primary;
TreeViewForeColor = foreColor;
TreeViewBackColor = Color.White;
TreeViewLineColor = UIFontColor.Primary;
TreeViewLineColor = foreColor;
EditorBackColor = UIColor.White;
NavMenuMenuSelectedColor = PrimaryColor;
DataGridViewFooterForeColor = UIFontColor.Primary;
DataGridViewFooterForeColor = foreColor;
PaginationForeColor = PrimaryColor;
@ -398,7 +401,7 @@ namespace Sunny.UI
{
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()
{
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)
{
Init(styleColor, UIStyle.Colorful, foreColor);
Init(styleColor, UIStyle.Colorful, foreColor, UIFontColor.Primary);
}
}
@ -424,7 +427,7 @@ namespace Sunny.UI
{
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()
{
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()
{
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()
{
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()
{
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()
{
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()
{
base.Init(UIColor.Blue, UIStyle.DarkBlue, Color.White);
base.Init(UIColor.Blue, UIStyle.DarkBlue, Color.White, UIFontColor.White);
PrimaryColor = UIColor.DarkBlue;
RectColor = Color.FromArgb(18, 58, 92);
@ -566,6 +569,11 @@ namespace Sunny.UI
ScrollBarFillColor = PlainColor;
ScrollBarForeColor = ForeColor;
ScrollingTextFillColor = PlainColor;
ScrollingTextForeColor = ForeColor;
LogoForeColor = UIFontColor.Primary;
}
}
@ -573,7 +581,8 @@ namespace Sunny.UI
{
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);
}
}
}