From b07b15cf427a03a09c3ddc4b32b30a9bf23fbfb7 Mon Sep 17 00:00:00 2001 From: donlaci Date: Wed, 5 Jun 2024 13:58:39 +0200 Subject: [PATCH] Modifying preview drawing colors for light theme. --- .../Projects/ProjectsEditor/Common/ThemeManager.cs | 4 ++-- .../Projects/ProjectsEditor/Utils/DrawHelper.cs | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/modules/Projects/ProjectsEditor/Common/ThemeManager.cs b/src/modules/Projects/ProjectsEditor/Common/ThemeManager.cs index a1b742abbb..780cc1c7df 100644 --- a/src/modules/Projects/ProjectsEditor/Common/ThemeManager.cs +++ b/src/modules/Projects/ProjectsEditor/Common/ThemeManager.cs @@ -20,7 +20,7 @@ namespace ProjectsEditor.Common private const string HighContrastBlackTheme = "HighContrast.Accent4"; private const string HighContrastWhiteTheme = "HighContrast.Accent5"; - private Theme _currentTheme; + private static Theme _currentTheme; private Theme _settingsTheme; private bool _disposed; @@ -76,7 +76,7 @@ namespace ProjectsEditor.Common } } - public Theme GetCurrentTheme() + public static Theme GetCurrentTheme() { return _currentTheme; } diff --git a/src/modules/Projects/ProjectsEditor/Utils/DrawHelper.cs b/src/modules/Projects/ProjectsEditor/Utils/DrawHelper.cs index fc42b44908..3af0696e5f 100644 --- a/src/modules/Projects/ProjectsEditor/Utils/DrawHelper.cs +++ b/src/modules/Projects/ProjectsEditor/Utils/DrawHelper.cs @@ -11,11 +11,7 @@ using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Media.Imaging; -using System.Windows.Media.Media3D; -using ModernWpf.Media.Animation; using ProjectsEditor.Models; namespace ProjectsEditor.Utils @@ -101,7 +97,7 @@ namespace ProjectsEditor.Utils g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.Clear(Color.FromArgb(0, 0, 0, 0)); - Brush brush = new SolidBrush(Color.FromArgb(10, 255, 255, 255)); // TODO: set theme-related colors + Brush brush = new SolidBrush(Common.ThemeManager.GetCurrentTheme() == Common.Theme.Dark ? Color.FromArgb(10, 255, 255, 255) : Color.FromArgb(10, 0, 0, 0)); foreach (Application app in project.Applications.Where(x => x.IsSelected && !x.Minimized)) { Rectangle rect = new Rectangle(Scaled(app.ScaledPosition.X - bounds.Left), Scaled(app.ScaledPosition.Y - bounds.Top), Scaled(app.ScaledPosition.Width), Scaled(app.ScaledPosition.Height)); @@ -144,11 +140,11 @@ namespace ProjectsEditor.Utils { if (app.IsHighlighted) { - graphics.DrawPath(new Pen(Color.White, graphics.VisibleClipBounds.Height / 25), path); // TODO: set theme-related colors + graphics.DrawPath(new Pen(Common.ThemeManager.GetCurrentTheme() == Common.Theme.Dark ? Color.White : Color.DarkGray, graphics.VisibleClipBounds.Height / 25), path); } else { - graphics.DrawPath(new Pen(Color.FromArgb(128, 82, 82, 82), graphics.VisibleClipBounds.Height / 100), path); // TODO: set theme-related colors + graphics.DrawPath(new Pen(Common.ThemeManager.GetCurrentTheme() == Common.Theme.Dark ? Color.FromArgb(128, 82, 82, 82) : Color.FromArgb(128, 160, 160, 160), graphics.VisibleClipBounds.Height / 100), path); } graphics.FillPath(brush, path); @@ -202,11 +198,11 @@ namespace ProjectsEditor.Utils { if (apps.Where(x => x.IsHighlighted).Any()) { - graphics.DrawPath(new Pen(Color.White, graphics.VisibleClipBounds.Height / 25), path); + graphics.DrawPath(new Pen(Common.ThemeManager.GetCurrentTheme() == Common.Theme.Dark ? Color.White : Color.DarkGray, graphics.VisibleClipBounds.Height / 25), path); } else { - graphics.DrawPath(new Pen(Color.FromArgb(128, 82, 82, 82), graphics.VisibleClipBounds.Height / 100), path); + graphics.DrawPath(new Pen(Common.ThemeManager.GetCurrentTheme() == Common.Theme.Dark ? Color.FromArgb(128, 82, 82, 82) : Color.FromArgb(128, 160, 160, 160), graphics.VisibleClipBounds.Height / 100), path); } graphics.FillPath(brush, path);