From 0b492aba51b16b0ba7ca928fba10c72c92bb75a1 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Wed, 11 Dec 2024 10:23:24 -0800 Subject: [PATCH] Fix colored tab losing color when unselected (#18306) If we colored a tab, then switched to another tab, there's a bug that the unselected tab loses its color. This was introduced in PR #18109. This PR fixes that by actually applying the selected color to the tab (whoops). Additionally, I removed setting the "TabViewItemHeaderCloseButtonBackground" resource because it looked weird (see comment in PR). Closes #18226 --- src/cascadia/TerminalApp/TabBase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalApp/TabBase.cpp b/src/cascadia/TerminalApp/TabBase.cpp index 7c80e366861..7fa6418cc17 100644 --- a/src/cascadia/TerminalApp/TabBase.cpp +++ b/src/cascadia/TerminalApp/TabBase.cpp @@ -528,6 +528,9 @@ namespace winrt::TerminalApp::implementation tabItemThemeResources.Insert(winrt::box_value(L"Dark"), darkThemeDictionary); tabItemThemeResources.Insert(winrt::box_value(L"HighContrast"), highContrastThemeDictionary); + // Apply the color to the tab + TabViewItem().Background(deselectedTabBrush); + // Now actually set the resources we want in them. // Before, we used to put these on the ResourceDictionary directly. // However, HighContrast mode may require some adjustments. So let's just add @@ -560,7 +563,6 @@ namespace winrt::TerminalApp::implementation currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderSelectedCloseButtonForeground"), fontBrush); // TabViewItem.CloseButton.Background (aka X button) - currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackground"), deselectedTabBrush); currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPressed"), isHighContrast ? selectedTabBrush : subtleFillColorTertiaryBrush); currentDictionary.Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPointerOver"), isHighContrast ? selectedTabBrush : subtleFillColorSecondaryBrush);