From fa43a710abb8473580cac1a656f77476a187e3f6 Mon Sep 17 00:00:00 2001 From: OliverT87 Date: Sat, 21 Jun 2025 13:14:33 +0200 Subject: [PATCH] =?UTF-8?q?dark,=20classic=20und=20bright=20theme=20korrek?= =?UTF-8?q?t=20eingef=C3=BCgt=20auf=20allen=203=20seiten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project_Periodensystem.View/AboutPage.axaml | 8 +++--- .../MainWindow.axaml.cs | 27 +++++++++++++++---- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Project_Periodensystem.View/AboutPage.axaml b/Project_Periodensystem.View/AboutPage.axaml index ca2170e..f20699c 100644 --- a/Project_Periodensystem.View/AboutPage.axaml +++ b/Project_Periodensystem.View/AboutPage.axaml @@ -30,14 +30,12 @@ HorizontalAlignment="Center"> + FontSize="20" + HorizontalAlignment="Center" + Margin="0,0,0,10"/> ThemeColors { get; } = new() + + public static Dictionary ThemeColors { get; } = new() { - { AppTheme.Dark, "#5C5144" }, - { AppTheme.Light, "#E8DFD8" }, - { AppTheme.Classic, "#7B8B6F" } + { AppTheme.Dark, ("#2F2F2F", "#FFFFFF") }, // Dunkles Anthrazit & Weiß + { AppTheme.Light, ("#FFFFFF", "#000000") }, // Weiß & Schwarz + { AppTheme.Classic, ("#E8E8E8", "#000000") } // Stylisches Grau & Schwarz }; public MainWindow() @@ -28,16 +32,19 @@ namespace Project_Periodensystem.View public void ShowLandingPage() { mainContent!.Content = new LandingPage(); + UpdateTheme(AppTheme.Dark); } public void ShowPeriodicTable() { mainContent!.Content = new PeriodicTablePage(); + UpdateTheme(AppTheme.Dark); } public void ShowAboutPage() { mainContent!.Content = new AboutPage(); + UpdateTheme(AppTheme.Dark); } public void UpdateTheme(AppTheme theme) @@ -45,7 +52,17 @@ namespace Project_Periodensystem.View CurrentTheme = theme; if (mainContent?.Content is UserControl control) { - control.Background = new SolidColorBrush(Color.Parse(ThemeColors[theme])); + var (background, foreground) = ThemeColors[theme]; + control.Background = new SolidColorBrush(Color.Parse(background)); + + // Update text colors for all direct TextBlocks + foreach (var textBlock in control.GetVisualDescendants().OfType()) + { + if (textBlock.Parent is Button || textBlock.Parent.ToString().Contains("ElementTile")) + continue; + + textBlock.Foreground = new SolidColorBrush(Color.Parse(foreground)); + } } } }