Skip to content

Commit

Permalink
Use ThemeLookup for the SUI bg too (#14644)
Browse files Browse the repository at this point in the history
I can't exactly repro #14559. I suspect that's due to #14567 having been merged. This, however, seemed related. Without this, we'll use the App's `RequestedTheme` (the one that can't be changed at runtime), rather than the user's `requestedTheme`. That will do weird things, like make the BG of the SUI dark, with white expanders.

I think this should close #14559.
  • Loading branch information
zadjii-msft committed Jan 18, 2023
1 parent 8e04169 commit c79298d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cascadia/TerminalSettingsEditor/MainPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "InteractionViewModel.h"
#include "LaunchViewModel.h"
#include "..\types\inc\utils.hpp"
#include <..\WinRTUtils\inc\Utils.h>

#include <LibraryResources.h>

Expand Down Expand Up @@ -648,12 +649,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation

{
const auto& theme = _settingsSource.GlobalSettings().CurrentTheme();
const auto& requestedTheme = _settingsSource.GlobalSettings().CurrentTheme().RequestedTheme();

RequestedTheme(requestedTheme);

const auto bgKey = (theme.Window() != nullptr && theme.Window().UseMica()) ?
L"SettingsPageMicaBackground" :
L"SettingsPageBackground";

if (const auto bgColor = Resources().TryLookup(winrt::box_value(bgKey)))
// remember to use ThemeLookup to get the actual correct color for the
// currently requested theme.
if (const auto bgColor = ThemeLookup(Resources(), requestedTheme, winrt::box_value(bgKey)))
{
SettingsNav().Background(winrt::WUX::Media::SolidColorBrush(winrt::unbox_value<Windows::UI::Color>(bgColor)));
}
Expand Down

0 comments on commit c79298d

Please sign in to comment.