Misc dark mode color tweaks

Centralize remaining vibrant colors to WinFormsUtil
This commit is contained in:
Kurt 2026-01-08 00:26:09 -06:00
parent e3fa760f52
commit 3d74e763ba
24 changed files with 54 additions and 53 deletions

View File

@ -58,12 +58,12 @@ private void CB_Property_SelectedIndexChanged(object sender, EventArgs e)
if (hasValue)
L_PropValue.ResetForeColor();
else
L_PropValue.ForeColor = Color.Red;
L_PropValue.ForeColor = WinFormsUtil.ColorWarn;
}
else // no property, flag
{
L_PropValue.Text = string.Empty;
L_PropType.ForeColor = Color.Red;
L_PropType.ForeColor = WinFormsUtil.ColorWarn;
}
}

View File

@ -385,13 +385,13 @@ private void UpadteHandlingTrainerBackground(int handler)
{
if (handler == 0) // OT
{
GB_OT.ForeColor = Color.Red;
GB_OT.ForeColor = WinFormsUtil.ColorWarn;
GB_nOT.ResetForeColor();
CB_Handler.SelectedIndex = 0;
}
else // Handling Trainer
{
GB_nOT.ForeColor = Color.Red;
GB_nOT.ForeColor = WinFormsUtil.ColorWarn;
GB_OT.ResetForeColor();
CB_Handler.SelectedIndex = 1;
}

View File

@ -35,7 +35,7 @@ public int Populate(PKM pk, GameStrings strings, ushort move, EntityContext cont
if (valid)
L_Move.ResetForeColor();
else
L_Move.ForeColor = Color.Red;
L_Move.ForeColor = WinFormsUtil.ColorWarn;
L_Move.Width = size.Width;
Width = ctrlWidth;

View File

@ -1921,17 +1921,11 @@ private void InitializeComponent()
// Stats
//
Stats.Dock = System.Windows.Forms.DockStyle.Fill;
Stats.EVsFishy = System.Drawing.Color.LightYellow;
Stats.EVsInvalid = System.Drawing.Color.Red;
Stats.EVsMaxed = System.Drawing.Color.Honeydew;
Stats.HaX = false;
Stats.Location = new System.Drawing.Point(0, 8);
Stats.Margin = new System.Windows.Forms.Padding(0);
Stats.Name = "Stats";
Stats.Size = new System.Drawing.Size(331, 496);
Stats.StatDecreased = System.Drawing.Color.Blue;
Stats.StatHyperTrained = System.Drawing.Color.LightGreen;
Stats.StatIncreased = System.Drawing.Color.Red;
Stats.TabIndex = 0;
//
// Hidden_Moves

View File

@ -1799,8 +1799,7 @@ private void ValidateMove(object? sender, EventArgs e)
UpdateLegality(args: UpdateLegalityArgs.SkipMoveRepopulation);
}
private static readonly Brush BackLegal = new SolidBrush(Color.FromArgb(200, 255, 200));
private static readonly Brush DarkLegal = new SolidBrush(Color.FromArgb(020, 055, 020));
private static readonly Brush BrushLegal = new SolidBrush(WinFormsUtil.ColorValid);
private void ValidateMovePaint(object? sender, DrawItemEventArgs e)
{
@ -1811,7 +1810,7 @@ private void ValidateMovePaint(object? sender, DrawItemEventArgs e)
var valid = LegalMoveSource.Info.CanLearn((ushort)value) && !HaX;
var highlight = (e.State & DrawItemState.Selected) != 0;
var brush = highlight ? SystemBrushes.MenuHighlight : (valid ? Application.IsDarkModeEnabled ? DarkLegal : BackLegal : SystemBrushes.ControlLightLight);
var brush = highlight ? SystemBrushes.MenuHighlight : (valid ? BrushLegal : SystemBrushes.ControlLightLight);
var textColor = highlight && !Application.IsDarkModeEnabled ? SystemColors.HighlightText : SystemColors.ControlText;
var type = MoveInfo.GetType((ushort)value, Entity.Context);

View File

@ -164,7 +164,7 @@ private void NUD_Scale_ValueChanged(object sender, EventArgs e)
label.Text = SizeClass[(int)PokeSizeUtil.GetSizeRating(value)];
if (value is 0 or 255) // Tiny or Jumbo Mark possible.
label.ForeColor = Color.Red;
label.ForeColor = WinFormsUtil.ColorWarn;
else
label.ResetForeColor();
}

View File

@ -34,12 +34,12 @@ public StatEditor()
gv.MouseWheel += WinFormsUtil.MouseWheelIncrement1;
}
public Color EVsInvalid { get; set; } = Color.Red;
public Color EVsMaxed { get; set; } = Color.Honeydew;
public Color EVsFishy { get; set; } = Color.LightYellow;
public Color StatIncreased { get; set; } = Color.Red;
public Color StatDecreased { get; set; } = Color.Blue;
public Color StatHyperTrained { get; set; } = Color.LightGreen;
private static Color EVsInvalid => Color.Red;
private static Color EVsMaxed => Color.LightGreen;
private static Color EVsFishy => Color.Yellow;
private static Color StatIncreased => WinFormsUtil.ColorPlus;
private static Color StatDecreased => WinFormsUtil.ColorMinus;
private static Color StatHyperTrained => Color.LightGreen;
public PKMEditor MainEditor { private get; set; } = null!;
public bool HaX { get => CHK_HackedStats.Enabled; set => CHK_HackedStats.Enabled = CHK_HackedStats.Visible = value; }

View File

@ -341,7 +341,7 @@ private void InitializeComponent()
//
// L_ReadOnlyOther
//
L_ReadOnlyOther.ForeColor = System.Drawing.Color.Red;
L_ReadOnlyOther.ForeColor = WinFormsUtil.ColorWarn;
L_ReadOnlyOther.Location = new System.Drawing.Point(32, 208);
L_ReadOnlyOther.Name = "L_ReadOnlyOther";
L_ReadOnlyOther.Size = new System.Drawing.Size(176, 24);

View File

@ -159,7 +159,6 @@ private void InitializeComponent()
// L_HintIllegal
//
L_HintIllegal.AutoSize = true;
L_HintIllegal.ForeColor = System.Drawing.Color.Red;
L_HintIllegal.Location = new System.Drawing.Point(2, 133);
L_HintIllegal.Margin = new System.Windows.Forms.Padding(2, 4, 0, 4);
L_HintIllegal.Name = "L_HintIllegal";

View File

@ -19,6 +19,7 @@ public PokePreview()
InitializeComponent();
InitialWidth = Width;
InitialNameWidth = L_Name.Width;
L_HintIllegal.ForeColor = WinFormsUtil.ColorWarn;
}
private static readonly Image[] GenderImages =

View File

@ -35,7 +35,7 @@ public static class SlotUtil
};
public static readonly Color GoodDataColor = Color.Transparent;
public static readonly Color BadDataColor = Color.Red;
public static Color BadDataColor => WinFormsUtil.ColorWarn;
/// <summary>
/// Refreshes a <see cref="PictureBox"/> with the appropriate display content.

View File

@ -150,12 +150,12 @@ private void PopulateRecords()
if (isValid)
{
var cell = row.Cells[ColumnPurchased];
cell.Style.BackColor = cell.Style.SelectionBackColor = Color.LightGreen;
cell.Style.BackColor = cell.Style.SelectionBackColor = WinFormsUtil.ColorValid;
}
else
{
var cell = row.Cells[ColumnPurchased];
cell.Style.SelectionBackColor = Color.Red;
cell.Style.SelectionBackColor = WinFormsUtil.ColorWarn;
}
row.Cells[ColumnIndex].Value = $"{i + Bias:00}";
row.Cells[ColumnType].Value = type.ToString("00") + (isValid ? 0 : 1) + names[move]; // type -> valid -> name sorting

View File

@ -60,15 +60,15 @@ private void PopulateRecords(EntityContext context, ReadOnlySpan<ushort> current
Color color;
if (currentMoves.Contains(move))
{
color = Color.LightBlue;
color = WinFormsUtil.ColorAccept;
}
else if (span[move])
{
color = Color.LightGreen;
color = WinFormsUtil.ColorValid;
}
else
{
color = Color.LightCoral;
color = WinFormsUtil.ColorSuspect;
isValid = false;
}
SetStyleColor(cell, color);

View File

@ -107,7 +107,7 @@ private void PopulateRibbons()
{
var name = rib.Name;
Color color = dict.TryGetValue(name, out var r)
? r.IsMissing ? Color.LightYellow : Color.Pink
? r.IsMissing ? WinFormsUtil.ColorHint : WinFormsUtil.ColorSuspect
: GetColor(otherList, name);
AddRibbonChoice(rib, color);
}
@ -134,11 +134,13 @@ private static int GetSortOrder(string name, Dictionary<string, RibbonResult> di
private static Color GetColor(List<RibbonInfo> otherList, string ribName)
{
if (ribName.StartsWith("RibbonMark"))
return Color.SeaShell;
return WinFormsUtil.ColorAlternate;
var other = otherList.Find(z => z.Name == ribName);
if (other is null)
return Color.Transparent;
return other.HasRibbon ? Color.PaleGreen : Color.Transparent;
if (!other.HasRibbon)
return Color.Transparent;
return WinFormsUtil.ColorValid;
}
private void AddRibbonSprite(RibbonInfo rib)
@ -182,7 +184,7 @@ private void AddRibbonChoice(RibbonInfo rib, Color color)
AutoSize = true,
};
if (color != Color.Transparent)
label.ForeColor = Color.Black;
label.ForeColor = SystemColors.ControlText;
TLP_Ribbons.Controls.Add(label, 1, row);
if (rib.Type is RibbonValueType.Byte) // numeric count ribbon
@ -259,7 +261,7 @@ private void ToggleNewRibbon(RibbonInfo rib, Control pb)
if (!EnableBackgroundChange)
return;
LastToggledOn?.BackColor = Color.Transparent;
pb.BackColor = rib.HasRibbon ? Color.LightBlue : Color.Transparent;
pb.BackColor = rib.HasRibbon ? WinFormsUtil.ColorAccept : Color.Transparent;
LastToggledOn = pb;
}

View File

@ -51,17 +51,13 @@ private void PopulateRecords(EntityContext context, ReadOnlySpan<ushort> current
bool isValid = Record.Permit.IsRecordPermitted(i);
if (isValid)
SetStyleColor(cell, Color.LightGreen);
SetStyleColor(cell, WinFormsUtil.ColorValid);
else if (Record.IsRecordPermitted(evos, i))
SetStyleColor(cell, Color.Yellow);
SetStyleColor(cell, WinFormsUtil.ColorHint);
else
SetStyleColor(cell, Color.LightCoral);
SetStyleColor(cell, WinFormsUtil.ColorSuspect);
if (currentMoves.Contains(move))
{
var style = cells[ColumnName].Style;
style.BackColor = Color.LightBlue;
style.ForeColor = Color.Black;
}
cells[ColumnName].Style.BackColor = WinFormsUtil.ColorAccept;
cells[ColumnIndex].Value = (i+ baseRecordIndex).ToString("000");
cells[ColumnTypeIcon].Value = TypeSpriteUtil.GetTypeSpriteIconSmall(type);

View File

@ -43,7 +43,7 @@ public SAV_DLC5(SAV5 sav)
Tab_BattleTest.Controls.Add(new Label
{
Text = "Not working. Needs research.",
ForeColor = Color.Red, Location = new(20,20),
ForeColor = WinFormsUtil.ColorWarn, Location = new(20,20),
AutoSize = true,
});
}

View File

@ -1,4 +1,4 @@
namespace PKHeX.WinForms
namespace PKHeX.WinForms
{
partial class SAV_BlockDump8
{
@ -365,7 +365,7 @@ private void InitializeComponent()
// L_BlockName
//
L_BlockName.AutoSize = true;
L_BlockName.ForeColor = System.Drawing.Color.Red;
L_BlockName.ForeColor = WinFormsUtil.ColorWarn;
L_BlockName.Location = new System.Drawing.Point(316, 5);
L_BlockName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
L_BlockName.Name = "L_BlockName";

View File

@ -294,7 +294,7 @@ private void InitializeComponent()
// L_EventFlagWarn
//
L_EventFlagWarn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
L_EventFlagWarn.ForeColor = System.Drawing.Color.Red;
L_EventFlagWarn.ForeColor = WinFormsUtil.ColorWarn;
L_EventFlagWarn.Location = new System.Drawing.Point(10, 374);
L_EventFlagWarn.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
L_EventFlagWarn.Name = "L_EventFlagWarn";

View File

@ -282,7 +282,7 @@ private void InitializeComponent()
// L_EventFlagWarn
//
L_EventFlagWarn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
L_EventFlagWarn.ForeColor = System.Drawing.Color.Red;
L_EventFlagWarn.ForeColor = WinFormsUtil.ColorWarn;
L_EventFlagWarn.Location = new System.Drawing.Point(10, 374);
L_EventFlagWarn.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
L_EventFlagWarn.Name = "L_EventFlagWarn";

View File

@ -75,7 +75,7 @@ private void AddFlagList(EventLabelCollection list, bool[] values)
if (labels.Count == 0)
{
dgv.Visible = false;
var research = new Label { Text = MsgResearchRequired, Name = "TLP_Flags_Research", ForeColor = Color.Red, AutoSize = true, Location = new Point(20, 20) };
var research = new Label { Text = MsgResearchRequired, Name = "TLP_Flags_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true, Location = new Point(20, 20) };
GB_Flags.Controls.Add(research);
return;
}
@ -154,7 +154,7 @@ private void AddConstList(EventLabelCollection list, ushort[] values)
var labels = list.Work;
if (labels.Count == 0)
{
TLP_Const.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = Color.Red, AutoSize = true }, 0, 0);
TLP_Const.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true }, 0, 0);
return;
}

View File

@ -282,7 +282,7 @@ private void InitializeComponent()
// L_EventFlagWarn
//
L_EventFlagWarn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
L_EventFlagWarn.ForeColor = System.Drawing.Color.Red;
L_EventFlagWarn.ForeColor = WinFormsUtil.ColorWarn;
L_EventFlagWarn.Location = new System.Drawing.Point(10, 374);
L_EventFlagWarn.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
L_EventFlagWarn.Name = "L_EventFlagWarn";

View File

@ -75,7 +75,7 @@ private void AddFlagList(EventLabelCollection list, bool[] values)
if (labels.Count == 0)
{
dgv.Visible = false;
var research = new Label { Text = MsgResearchRequired, Name = "TLP_Flags_Research", ForeColor = Color.Red, AutoSize = true, Location = new Point(20, 20) };
var research = new Label { Text = MsgResearchRequired, Name = "TLP_Flags_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true, Location = new Point(20, 20) };
GB_Flags.Controls.Add(research);
return;
}
@ -154,7 +154,7 @@ private void AddConstList(EventLabelCollection list, ReadOnlySpan<byte> values)
var labels = list.Work;
if (labels.Count == 0)
{
TLP_Const.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = Color.Red, AutoSize = true }, 0, 0);
TLP_Const.Controls.Add(new Label { Text = MsgResearchRequired, Name = "TLP_Const_Research", ForeColor = WinFormsUtil.ColorWarn, AutoSize = true }, 0, 0);
return;
}

View File

@ -265,7 +265,7 @@ private void InitializeComponent()
// L_EventFlagWarn
//
L_EventFlagWarn.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left;
L_EventFlagWarn.ForeColor = System.Drawing.Color.Red;
L_EventFlagWarn.ForeColor = WinFormsUtil.ColorWarn;
L_EventFlagWarn.Location = new System.Drawing.Point(10, 374);
L_EventFlagWarn.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
L_EventFlagWarn.Name = "L_EventFlagWarn";

View File

@ -569,4 +569,14 @@ public static void InvertToolStripIcons(ToolStripItemCollection collection)
}
public static Bitmap BlackToWhite(Image img) => Drawing.ImageUtil.ChangeAllColorTo(img, Color.White);
// SystemColor equivalents for dark mode support
public static Color ColorWarn => Application.IsDarkModeEnabled ? Color.OrangeRed : Color.Red;
public static Color ColorValid => Application.IsDarkModeEnabled ? Color.FromArgb(030, 070, 030) : Color.FromArgb(200, 255, 200);
public static Color ColorHint => Application.IsDarkModeEnabled ? Color.DarkKhaki : Color.LightYellow;
public static Color ColorSuspect => Application.IsDarkModeEnabled ? Color.LightCoral : Color.LightSalmon;
public static Color ColorAccept => Application.IsDarkModeEnabled ? Color.DarkSlateBlue : Color.LightBlue;
public static Color ColorPlus => Application.IsDarkModeEnabled ? Color.OrangeRed : Color.Red;
public static Color ColorMinus => Application.IsDarkModeEnabled ? Color.MediumBlue : Color.Blue;
public static Color ColorAlternate => Application.IsDarkModeEnabled ? Color.SlateGray : Color.SeaShell;
}