Add "Dark theme" option to settings

This commit is contained in:
Nikolaj Olsson 2020-12-18 19:37:00 +01:00
parent 3ba141e798
commit 40eecc938f
10 changed files with 192 additions and 55 deletions

View File

@ -1583,6 +1583,7 @@ If you have edited this file with Subtitle Edit you might be able to find a back
<NoSupportHereVobSub>VobSub files are not supported here.</NoSupportHereVobSub>
<NoSupportHereDivx>DivX files are not supported here.</NoSupportHereDivx>
<NoChapters>No chapters found in the video.</NoChapters>
<DarkThemeRestart>Restart Subtitle Edit for dark theme changes to take effect.</DarkThemeRestart>
</Main>
<MatroskaSubtitleChooser>
<Title>Choose subtitle from Matroska file</Title>
@ -2114,6 +2115,8 @@ can edit in same subtitle file (collaboration)</Information>
<UseSyntaxColoring>Use syntax coloring</UseSyntaxColoring>
<HtmlColor>Html color</HtmlColor>
<AssaColor>ASSA color</AssaColor>
<DarkTheme>Dark theme</DarkTheme>
<DarkThemeEnabled>Dark theme enabled</DarkThemeEnabled>
<UpdateShortcut>Update</UpdateShortcut>
<FoucsSetVideoPosition>Focus set video position</FoucsSetVideoPosition>
<ToggleDockUndockOfVideoControls>Toggle dock/undock of video controls</ToggleDockUndockOfVideoControls>

View File

@ -1168,6 +1168,8 @@ $HorzAlign = Center
public bool MeasurementConverterCloseOnInsert { get; set; }
public string MeasurementConverterCategories { get; set; }
public int SubtitleTextBoxMaxHeight { get; set; }
public Color DarkThemeForeColor { get; set; }
public Color DarkThemeBackColor { get; set; }
public bool UseDarkTheme { get; set; }
public bool ShowBetaStuff { get; set; }
@ -1297,6 +1299,8 @@ $HorzAlign = Center
ShowProgress = false;
ShowNegativeDurationInfoOnSave = true;
ShowFormatRequiresUtf8Warning = true;
DarkThemeForeColor = Color.FromArgb(155, 155, 155);
DarkThemeBackColor = Color.FromArgb(30, 30, 30);
UseDarkTheme = false;
TitleBarAsterisk = "before";
MeasurementConverterCloseOnInsert = true;
@ -3530,6 +3534,18 @@ $HorzAlign = Center
settings.General.SubtitleTextBoxMaxHeight = Convert.ToInt32(subNode.InnerText.Trim(), CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("DarkThemeBackColor");
if (subNode != null)
{
settings.General.DarkThemeBackColor = Color.FromArgb(int.Parse(subNode.InnerText, CultureInfo.InvariantCulture));
}
subNode = node.SelectSingleNode("DarkThemeForeColor");
if (subNode != null)
{
settings.General.DarkThemeForeColor = Color.FromArgb(int.Parse(subNode.InnerText, CultureInfo.InvariantCulture));
}
subNode = node.SelectSingleNode("UseDarkTheme");
if (subNode != null)
{
@ -7950,6 +7966,8 @@ $HorzAlign = Center
textWriter.WriteElementString("MeasurementConverterCloseOnInsert", settings.General.MeasurementConverterCloseOnInsert.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("MeasurementConverterCategories", settings.General.MeasurementConverterCategories);
textWriter.WriteElementString("SubtitleTextBoxMaxHeight", settings.General.SubtitleTextBoxMaxHeight.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("DarkThemeBackColor", settings.General.DarkThemeBackColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("DarkThemeForeColor", settings.General.DarkThemeForeColor.ToArgb().ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("UseDarkTheme", settings.General.UseDarkTheme.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("ShowBetaStuff", settings.General.ShowBetaStuff.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("NewEmptyDefaultMs", settings.General.NewEmptyDefaultMs.ToString(CultureInfo.InvariantCulture));

View File

@ -1469,6 +1469,7 @@ namespace Nikse.SubtitleEdit.Core
NoSupportHereVobSub = "VobSub files are not supported here.",
NoSupportHereDivx = "DivX files are not supported here.",
NoChapters = "No chapters found in the video.",
DarkThemeRestart = "Restart Subtitle Edit for dark theme changes to take effect.",
Menu = new LanguageStructure.Main.MainMenu
{
@ -2419,6 +2420,8 @@ can edit in same subtitle file (collaboration)",
UseSyntaxColoring = "Use syntax coloring",
HtmlColor = "Html color",
AssaColor = "ASSA color",
DarkTheme ="Dark theme",
DarkThemeEnabled = "Dark theme enabled",
ListViewAndTextBox = "List view and text box",
UpdateShortcut = "Update",
FoucsSetVideoPosition = "Focus set video position",

View File

@ -3397,6 +3397,9 @@ namespace Nikse.SubtitleEdit.Core
case "Main/NoChapters":
language.Main.NoChapters = reader.Value;
break;
case "Main/DarkThemeRestart":
language.Main.DarkThemeRestart = reader.Value;
break;
case "Main/Menu/File/Title":
language.Main.Menu.File.Title = reader.Value;
break;
@ -5764,6 +5767,12 @@ namespace Nikse.SubtitleEdit.Core
case "Settings/AssaColor":
language.Settings.AssaColor = reader.Value;
break;
case "Settings/DarkTheme":
language.Settings.DarkTheme = reader.Value;
break;
case "Settings/DarkThemeEnabled":
language.Settings.DarkThemeEnabled = reader.Value;
break;
case "Settings/UpdateShortcut":
language.Settings.UpdateShortcut = reader.Value;
break;

View File

@ -1330,6 +1330,7 @@
public string NoSupportHereVobSub { get; set; }
public string NoSupportHereDivx { get; set; }
public string NoChapters { get; set; }
public string DarkThemeRestart { get; set; }
public class MainMenu
{
@ -2280,6 +2281,8 @@
public string UseSyntaxColoring { get; set; }
public string HtmlColor { get; set; }
public string AssaColor { get; set; }
public string DarkTheme { get; set; }
public string DarkThemeEnabled { get; set; }
public string UpdateShortcut { get; set; }
public string FoucsSetVideoPosition { get; set; }
public string ToggleDockUndockOfVideoControls { get; set; }

View File

@ -4585,6 +4585,7 @@ namespace Nikse.SubtitleEdit.Forms
var oldSubtitleAlignment = Configuration.Settings.General.CenterSubtitleInTextBox;
var oldSubtitleTextBoxHtmlColor = Configuration.Settings.General.SubtitleTextBoxHtmlColor.ToArgb().ToString();
var oldSubtitleTextBoxAssaColor = Configuration.Settings.General.SubtitleTextBoxAssColor.ToArgb().ToString();
var oldUseDarkTheme = Configuration.Settings.General.UseDarkTheme;
using (var settings = new Options.Settings())
{
settings.Initialize(Icon, toolStripButtonFileNew.Image, toolStripButtonFileOpen.Image, toolStripButtonSave.Image, toolStripButtonSaveAs.Image, toolStripButtonFind.Image,
@ -4767,7 +4768,24 @@ namespace Nikse.SubtitleEdit.Forms
RefreshTimeCodeMode();
}
if (oldSubtitleTextBoxSyntaxColor != Configuration.Settings.General.SubtitleTextBoxSyntaxColor ||
if (oldUseDarkTheme != Configuration.Settings.General.UseDarkTheme)
{
if (Configuration.Settings.General.UseDarkTheme)
{
OnLoad(null);
textBoxListViewText.Initialize(Configuration.Settings.General.SubtitleTextBoxSyntaxColor);
textBoxListViewTextAlternate.Initialize(Configuration.Settings.General.SubtitleTextBoxSyntaxColor);
SubtitleListview1.BackColor = Configuration.Settings.General.SubtitleBackgroundColor;
RefreshSelectedParagraph();
}
else
{
Configuration.Settings.General.SubtitleBackgroundColor = new TextBox().BackColor;
Configuration.Settings.General.SubtitleFontColor = DefaultForeColor;
MessageBox.Show(Configuration.Settings.Language.Main.DarkThemeRestart);
}
}
else if (oldSubtitleTextBoxSyntaxColor != Configuration.Settings.General.SubtitleTextBoxSyntaxColor ||
oldSubtitleFontSize != Configuration.Settings.General.SubtitleTextBoxFontSize ||
oldSubtitleAlignment != Configuration.Settings.General.CenterSubtitleInTextBox ||
oldSubtitleTextBoxHtmlColor != Configuration.Settings.General.SubtitleTextBoxHtmlColor.ToArgb().ToString() ||

View File

@ -327,6 +327,12 @@
this.checkBoxToolbarNew = new System.Windows.Forms.CheckBox();
this.tabPageFont = new System.Windows.Forms.TabPage();
this.groupBoxFont = new System.Windows.Forms.GroupBox();
this.groupBoxDarkTheme = new System.Windows.Forms.GroupBox();
this.checkBoxDarkThemeEnabled = new System.Windows.Forms.CheckBox();
this.panelDarkThemeBackColor = new System.Windows.Forms.Panel();
this.buttonDarkThemeBackColor = new System.Windows.Forms.Button();
this.panelDarkThemeColor = new System.Windows.Forms.Panel();
this.buttonDarkThemeColor = new System.Windows.Forms.Button();
this.labelFontNote = new System.Windows.Forms.Label();
this.groupBoxFontTextBox = new System.Windows.Forms.GroupBox();
this.panelTextBoxAssColor = new System.Windows.Forms.Panel();
@ -454,6 +460,7 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBoxNew)).BeginInit();
this.tabPageFont.SuspendLayout();
this.groupBoxFont.SuspendLayout();
this.groupBoxDarkTheme.SuspendLayout();
this.groupBoxFontTextBox.SuspendLayout();
this.groupBoxFontListViews.SuspendLayout();
this.groupBoxFontGeneral.SuspendLayout();
@ -4047,6 +4054,7 @@
this.groupBoxFont.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxFont.Controls.Add(this.groupBoxDarkTheme);
this.groupBoxFont.Controls.Add(this.labelFontNote);
this.groupBoxFont.Controls.Add(this.groupBoxFontTextBox);
this.groupBoxFont.Controls.Add(this.groupBoxFontListViews);
@ -4058,10 +4066,70 @@
this.groupBoxFont.TabStop = false;
this.groupBoxFont.Text = "Font in UI";
//
// groupBoxDarkTheme
//
this.groupBoxDarkTheme.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxDarkTheme.Controls.Add(this.checkBoxDarkThemeEnabled);
this.groupBoxDarkTheme.Controls.Add(this.panelDarkThemeBackColor);
this.groupBoxDarkTheme.Controls.Add(this.buttonDarkThemeBackColor);
this.groupBoxDarkTheme.Controls.Add(this.panelDarkThemeColor);
this.groupBoxDarkTheme.Controls.Add(this.buttonDarkThemeColor);
this.groupBoxDarkTheme.Location = new System.Drawing.Point(14, 315);
this.groupBoxDarkTheme.Name = "groupBoxDarkTheme";
this.groupBoxDarkTheme.Size = new System.Drawing.Size(806, 112);
this.groupBoxDarkTheme.TabIndex = 40;
this.groupBoxDarkTheme.TabStop = false;
this.groupBoxDarkTheme.Text = "Dark theme";
//
// checkBoxDarkThemeEnabled
//
this.checkBoxDarkThemeEnabled.AutoSize = true;
this.checkBoxDarkThemeEnabled.Location = new System.Drawing.Point(16, 25);
this.checkBoxDarkThemeEnabled.Name = "checkBoxDarkThemeEnabled";
this.checkBoxDarkThemeEnabled.Size = new System.Drawing.Size(122, 17);
this.checkBoxDarkThemeEnabled.TabIndex = 43;
this.checkBoxDarkThemeEnabled.Text = "Dark theme enabled";
this.checkBoxDarkThemeEnabled.UseVisualStyleBackColor = true;
//
// panelDarkThemeBackColor
//
this.panelDarkThemeBackColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelDarkThemeBackColor.Location = new System.Drawing.Point(140, 78);
this.panelDarkThemeBackColor.Name = "panelDarkThemeBackColor";
this.panelDarkThemeBackColor.Size = new System.Drawing.Size(21, 20);
this.panelDarkThemeBackColor.TabIndex = 42;
//
// buttonDarkThemeBackColor
//
this.buttonDarkThemeBackColor.Location = new System.Drawing.Point(16, 77);
this.buttonDarkThemeBackColor.Name = "buttonDarkThemeBackColor";
this.buttonDarkThemeBackColor.Size = new System.Drawing.Size(112, 23);
this.buttonDarkThemeBackColor.TabIndex = 40;
this.buttonDarkThemeBackColor.Text = "Back color";
this.buttonDarkThemeBackColor.UseVisualStyleBackColor = true;
//
// panelDarkThemeColor
//
this.panelDarkThemeColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelDarkThemeColor.Location = new System.Drawing.Point(140, 49);
this.panelDarkThemeColor.Name = "panelDarkThemeColor";
this.panelDarkThemeColor.Size = new System.Drawing.Size(21, 20);
this.panelDarkThemeColor.TabIndex = 41;
//
// buttonDarkThemeColor
//
this.buttonDarkThemeColor.Location = new System.Drawing.Point(16, 48);
this.buttonDarkThemeColor.Name = "buttonDarkThemeColor";
this.buttonDarkThemeColor.Size = new System.Drawing.Size(112, 23);
this.buttonDarkThemeColor.TabIndex = 39;
this.buttonDarkThemeColor.Text = "Color";
this.buttonDarkThemeColor.UseVisualStyleBackColor = true;
//
// labelFontNote
//
this.labelFontNote.AutoSize = true;
this.labelFontNote.Location = new System.Drawing.Point(11, 352);
this.labelFontNote.Location = new System.Drawing.Point(10, 443);
this.labelFontNote.Name = "labelFontNote";
this.labelFontNote.Size = new System.Drawing.Size(278, 13);
this.labelFontNote.TabIndex = 41;
@ -4080,9 +4148,9 @@
this.groupBoxFontTextBox.Controls.Add(this.comboBoxSubtitleFontSize);
this.groupBoxFontTextBox.Controls.Add(this.checkBoxSubtitleFontBold);
this.groupBoxFontTextBox.Controls.Add(this.checkBoxSubtitleCenter);
this.groupBoxFontTextBox.Location = new System.Drawing.Point(14, 228);
this.groupBoxFontTextBox.Location = new System.Drawing.Point(14, 196);
this.groupBoxFontTextBox.Name = "groupBoxFontTextBox";
this.groupBoxFontTextBox.Size = new System.Drawing.Size(806, 116);
this.groupBoxFontTextBox.Size = new System.Drawing.Size(806, 113);
this.groupBoxFontTextBox.TabIndex = 40;
this.groupBoxFontTextBox.TabStop = false;
this.groupBoxFontTextBox.Text = "Text box";
@ -4206,9 +4274,9 @@
this.groupBoxFontListViews.Controls.Add(this.labelSubtitleListViewFontSize);
this.groupBoxFontListViews.Controls.Add(this.comboBoxSubtitleListViewFontSize);
this.groupBoxFontListViews.Controls.Add(this.checkBoxSubtitleListViewFontBold);
this.groupBoxFontListViews.Location = new System.Drawing.Point(14, 141);
this.groupBoxFontListViews.Location = new System.Drawing.Point(14, 132);
this.groupBoxFontListViews.Name = "groupBoxFontListViews";
this.groupBoxFontListViews.Size = new System.Drawing.Size(806, 81);
this.groupBoxFontListViews.Size = new System.Drawing.Size(806, 58);
this.groupBoxFontListViews.TabIndex = 39;
this.groupBoxFontListViews.TabStop = false;
this.groupBoxFontListViews.Text = "List view";
@ -4249,7 +4317,7 @@
// checkBoxSubtitleListViewFontBold
//
this.checkBoxSubtitleListViewFontBold.AutoSize = true;
this.checkBoxSubtitleListViewFontBold.Location = new System.Drawing.Point(210, 41);
this.checkBoxSubtitleListViewFontBold.Location = new System.Drawing.Point(289, 20);
this.checkBoxSubtitleListViewFontBold.Name = "checkBoxSubtitleListViewFontBold";
this.checkBoxSubtitleListViewFontBold.Size = new System.Drawing.Size(46, 17);
this.checkBoxSubtitleListViewFontBold.TabIndex = 35;
@ -4268,7 +4336,7 @@
this.groupBoxFontGeneral.Controls.Add(this.labelSubtitleFontBackgroundColor);
this.groupBoxFontGeneral.Location = new System.Drawing.Point(14, 20);
this.groupBoxFontGeneral.Name = "groupBoxFontGeneral";
this.groupBoxFontGeneral.Size = new System.Drawing.Size(806, 115);
this.groupBoxFontGeneral.Size = new System.Drawing.Size(806, 106);
this.groupBoxFontGeneral.TabIndex = 38;
this.groupBoxFontGeneral.TabStop = false;
this.groupBoxFontGeneral.Text = "General";
@ -4894,6 +4962,8 @@
this.tabPageFont.ResumeLayout(false);
this.groupBoxFont.ResumeLayout(false);
this.groupBoxFont.PerformLayout();
this.groupBoxDarkTheme.ResumeLayout(false);
this.groupBoxDarkTheme.PerformLayout();
this.groupBoxFontTextBox.ResumeLayout(false);
this.groupBoxFontTextBox.PerformLayout();
this.groupBoxFontListViews.ResumeLayout(false);
@ -5296,5 +5366,11 @@
private System.Windows.Forms.Panel panelTextBoxHtmlColor;
private System.Windows.Forms.Button buttonTextBoxHtmlColor;
private System.Windows.Forms.CheckBox checkBoxSubtitleTextBoxSyntaxColor;
private System.Windows.Forms.GroupBox groupBoxDarkTheme;
private System.Windows.Forms.CheckBox checkBoxDarkThemeEnabled;
private System.Windows.Forms.Panel panelDarkThemeBackColor;
private System.Windows.Forms.Button buttonDarkThemeBackColor;
private System.Windows.Forms.Panel panelDarkThemeColor;
private System.Windows.Forms.Button buttonDarkThemeColor;
}
}

View File

@ -150,6 +150,9 @@ namespace Nikse.SubtitleEdit.Forms.Options
checkBoxSubtitleTextBoxSyntaxColor.Checked = gs.SubtitleTextBoxSyntaxColor;
panelTextBoxHtmlColor.BackColor = gs.SubtitleTextBoxHtmlColor;
panelTextBoxAssColor.BackColor = gs.SubtitleTextBoxAssColor;
panelDarkThemeBackColor.BackColor = gs.DarkThemeBackColor;
panelDarkThemeColor.BackColor = gs.DarkThemeForeColor;
checkBoxDarkThemeEnabled.Checked = gs.UseDarkTheme;
checkBoxSubtitleListViewFontBold.Checked = gs.SubtitleListViewFontBold;
checkBoxSubtitleCenter.Checked = gs.CenterSubtitleInTextBox;
panelSubtitleFontColor.BackColor = gs.SubtitleFontColor;
@ -437,6 +440,10 @@ namespace Nikse.SubtitleEdit.Forms.Options
checkBoxSubtitleTextBoxSyntaxColor.Text = language.UseSyntaxColoring;
buttonTextBoxHtmlColor.Text = language.HtmlColor;
buttonTextBoxAssColor.Text = language.AssaColor;
groupBoxDarkTheme.Text = language.DarkTheme;
checkBoxDarkThemeEnabled.Text = language.DarkThemeEnabled;
buttonDarkThemeColor.Text = language.WaveformTextColor;
buttonDarkThemeBackColor.Text = language.WaveformBackgroundColor;
checkBoxSubtitleListViewFontBold.Text = language.SubtitleBold;
checkBoxSubtitleCenter.Text = language.SubtitleCenter;
checkBoxSubtitleCenter.Left = checkBoxSubtitleFontBold.Left;
@ -1687,6 +1694,9 @@ namespace Nikse.SubtitleEdit.Forms.Options
gs.SubtitleTextBoxSyntaxColor = checkBoxSubtitleTextBoxSyntaxColor.Checked;
gs.SubtitleTextBoxHtmlColor = panelTextBoxHtmlColor.BackColor;
gs.SubtitleTextBoxAssColor = panelTextBoxAssColor.BackColor;
gs.DarkThemeBackColor = panelDarkThemeBackColor.BackColor;
gs.DarkThemeForeColor = panelDarkThemeColor.BackColor;
gs.UseDarkTheme = checkBoxDarkThemeEnabled.Checked;
gs.SubtitleListViewFontBold = checkBoxSubtitleListViewFontBold.Checked;
gs.CenterSubtitleInTextBox = checkBoxSubtitleCenter.Checked;
gs.SubtitleFontColor = panelSubtitleFontColor.BackColor;

View File

@ -20,13 +20,10 @@ namespace Nikse.SubtitleEdit.Logic
.Where(c => c.GetType() == type);
}
internal static readonly Color BackColor = Color.FromArgb(0x1e, 0x1e, 0x1e);
internal static readonly Color ForeColor = Color.FromArgb(150, 150, 150);
private static void TabControl1_DrawItem(object sender, DrawItemEventArgs e)
{
var sz = e.Graphics.MeasureString((sender as TabControl)?.TabPages[e.Index].Text, e.Font);
using (var br = new SolidBrush(BackColor))
using (var br = new SolidBrush(Configuration.Settings.General.DarkThemeBackColor))
{
e.Graphics.FillRectangle(br, e.Bounds);
e.Graphics.DrawString((sender as TabControl)?.TabPages[e.Index].Text, e.Font, Brushes.WhiteSmoke, e.Bounds.Left + (e.Bounds.Width - sz.Width) / 2, e.Bounds.Top + (e.Bounds.Height - sz.Height) / 2 + 1);
@ -34,14 +31,14 @@ namespace Nikse.SubtitleEdit.Logic
var rect = e.Bounds;
rect.Offset(0, 1);
rect.Inflate(0, -1);
e.Graphics.DrawRectangle(new Pen(ForeColor, 1), rect);
e.Graphics.DrawRectangle(new Pen(Configuration.Settings.General.DarkThemeForeColor, 1), rect);
e.DrawFocusRectangle();
}
}
private static void TabPage_Paint(object sender, PaintEventArgs e)
{
using (var fillBrush = new SolidBrush(BackColor))
using (var fillBrush = new SolidBrush(Configuration.Settings.General.DarkThemeBackColor))
{
e.Graphics.FillRectangle(fillBrush, e.ClipRectangle);
}
@ -63,9 +60,9 @@ namespace Nikse.SubtitleEdit.Logic
{
if (!_isConfigUpdated)
{
Configuration.Settings.General.SubtitleBackgroundColor = BackColor;
Configuration.Settings.General.SubtitleFontColor = ForeColor;
Configuration.Settings.VideoControls.WaveformBackgroundColor = BackColor;
Configuration.Settings.General.SubtitleBackgroundColor = Configuration.Settings.General.DarkThemeBackColor;
Configuration.Settings.General.SubtitleFontColor = Configuration.Settings.General.DarkThemeForeColor;
Configuration.Settings.VideoControls.WaveformBackgroundColor = Configuration.Settings.General.DarkThemeBackColor;
Configuration.Settings.VideoControls.WaveformGridColor = Color.FromArgb(62, 62, 60);
// prevent re-assignments
_isConfigUpdated = true;
@ -144,8 +141,8 @@ namespace Nikse.SubtitleEdit.Logic
var contextMenus = GetSubControls<ContextMenuStrip>(form);
foreach (ContextMenuStrip cms in contextMenus)
{
cms.BackColor = BackColor;
cms.ForeColor = ForeColor;
cms.BackColor = Configuration.Settings.General.DarkThemeBackColor;
cms.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
cms.Renderer = new MyRenderer();
cms.ShowImageMargin = false;
cms.ShowCheckMargin = false;
@ -158,41 +155,41 @@ namespace Nikse.SubtitleEdit.Logic
var toolStrips = GetSubControls<ToolStrip>(form);
foreach (ToolStrip c in toolStrips)
{
c.BackColor = BackColor;
c.ForeColor = ForeColor;
c.BackColor = Configuration.Settings.General.DarkThemeBackColor;
c.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
var toolStripContentPanels = GetSubControls<ToolStripContentPanel>(form);
foreach (ToolStripContentPanel c in toolStripContentPanels)
{
c.BackColor = BackColor;
c.ForeColor = ForeColor;
c.BackColor = Configuration.Settings.General.DarkThemeBackColor;
c.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
var toolStripContainers = GetSubControls<ToolStripContainer>(form);
foreach (ToolStripContainer c in toolStripContainers)
{
c.BackColor = BackColor;
c.ForeColor = ForeColor;
c.BackColor = Configuration.Settings.General.DarkThemeBackColor;
c.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
var toolStripDropDownMenus = GetSubControls<ToolStripDropDownMenu>(form);
foreach (ToolStripDropDownMenu c in toolStripDropDownMenus)
{
c.BackColor = BackColor;
c.ForeColor = ForeColor;
c.BackColor = Configuration.Settings.General.DarkThemeBackColor;
c.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
foreach (ToolStripItem x in c.Items)
{
x.BackColor = BackColor;
x.ForeColor = ForeColor;
x.BackColor = Configuration.Settings.General.DarkThemeBackColor;
x.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
}
var toolStripMenuItems = GetSubControls<ToolStripMenuItem>(form);
foreach (ToolStripMenuItem c in toolStripMenuItems)
{
c.BackColor = BackColor;
c.ForeColor = ForeColor;
c.BackColor = Configuration.Settings.General.DarkThemeBackColor;
c.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
var toolStripSeparators = GetSubControls<ToolStripSeparator>(form);
@ -200,13 +197,13 @@ namespace Nikse.SubtitleEdit.Logic
{
if (c.GetCurrentParent() is ToolStripDropDownMenu p)
{
p.BackColor = BackColor;
p.BackColor = Configuration.Settings.General.DarkThemeBackColor;
p.ShowCheckMargin = false;
p.ShowImageMargin = false;
}
c.BackColor = BackColor;
c.ForeColor = ForeColor;
c.BackColor = Configuration.Settings.General.DarkThemeBackColor;
c.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
}
@ -228,8 +225,8 @@ namespace Nikse.SubtitleEdit.Logic
private static void FixControl(Control c)
{
c.BackColor = BackColor;
c.ForeColor = ForeColor;
c.BackColor = Configuration.Settings.General.DarkThemeBackColor;
c.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
if (c is Button b)
{
@ -261,8 +258,8 @@ namespace Nikse.SubtitleEdit.Logic
{
if (x is ToolStripMenuItem item)
{
item.BackColor = BackColor;
item.ForeColor = ForeColor;
item.BackColor = Configuration.Settings.General.DarkThemeBackColor;
item.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
}
}
@ -272,18 +269,18 @@ namespace Nikse.SubtitleEdit.Logic
lv.OwnerDraw = true;
lv.DrawColumnHeader += lv_DrawColumnHeader;
lv.GridLines = false;
lv.ForeColor = ForeColor;
lv.BackColor = BackColor;
lv.BackColor = Configuration.Settings.General.DarkThemeBackColor;
lv.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
}
}
private static void lv_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
{
var lv = (ListView)sender;
lv.BackColor = BackColor;
lv.ForeColor = ForeColor;
lv.BackColor = lv.BackColor = Configuration.Settings.General.DarkThemeBackColor;
lv.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
e.DrawDefault = false;
using (var b = new SolidBrush(BackColor))
using (var b = new SolidBrush(Configuration.Settings.General.DarkThemeBackColor))
{
e.Graphics.FillRectangle(b, e.Bounds);
}
@ -299,7 +296,7 @@ namespace Nikse.SubtitleEdit.Logic
break;
}
using (var fc = new SolidBrush(ForeColor))
using (var fc = new SolidBrush(Configuration.Settings.General.DarkThemeForeColor))
{
e.Graphics.DrawString(e.Header.Text, e.Font, fc, e.Bounds, strFormat);
}
@ -309,7 +306,7 @@ namespace Nikse.SubtitleEdit.Logic
{
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
{
using (var brush = new SolidBrush(BackColor))
using (var brush = new SolidBrush(Configuration.Settings.General.DarkThemeBackColor))
{
e.Graphics.FillRectangle(brush, e.ConnectedArea);
}
@ -318,8 +315,8 @@ namespace Nikse.SubtitleEdit.Logic
internal static void SetDarkTheme(ToolStripItem item)
{
item.BackColor = BackColor;
item.ForeColor = ForeColor;
item.BackColor = Configuration.Settings.General.DarkThemeBackColor;
item.ForeColor = Configuration.Settings.General.DarkThemeForeColor;
if (item is ToolStripSeparator)
{
item.Paint += ToolStripSeparatorPaint;
@ -331,8 +328,8 @@ namespace Nikse.SubtitleEdit.Logic
var toolStripSeparator = (ToolStripSeparator)sender;
var width = toolStripSeparator.Width;
var height = toolStripSeparator.Height;
e.Graphics.FillRectangle(new SolidBrush(BackColor), 0, 0, width, height);
e.Graphics.DrawLine(new Pen(ForeColor), 4, height / 2, width - 4, height / 2);
e.Graphics.FillRectangle(new SolidBrush(Configuration.Settings.General.DarkThemeBackColor), 0, 0, width, height);
e.Graphics.DrawLine(new Pen(Configuration.Settings.General.DarkThemeForeColor), 4, height / 2, width - 4, height / 2);
}
}
}

View File

@ -1177,9 +1177,9 @@ namespace Nikse.SubtitleEdit.Logic
}
}
public static Color BackColor => Configuration.Settings.General.UseDarkTheme ? DarkTheme.BackColor : Control.DefaultBackColor;
public static Color BackColor => Configuration.Settings.General.UseDarkTheme ? Configuration.Settings.General.DarkThemeBackColor : Control.DefaultBackColor;
public static Color ForeColor => Configuration.Settings.General.UseDarkTheme ? DarkTheme.ForeColor : Control.DefaultForeColor;
public static Color ForeColor => Configuration.Settings.General.UseDarkTheme ? Configuration.Settings.General.DarkThemeForeColor : Control.DefaultForeColor;
public static void OpenFolderFromFileName(string fileName)
{