Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ThemeLookup for the SUI bg too #14644

Merged
1 commit merged into from
Jan 18, 2023
Merged

Conversation

zadjii-msft
Copy link
Member

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.

@ghost ghost added Area-Settings UI Anything specific to the SUI Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. labels Jan 6, 2023
@zadjii-msft
Copy link
Member Author

@carlos-zamora can you check this out and make sure #14559 doesn't repro anymore?

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue no longer repros. Thanks!

I did notice this though:
theme is set to light, but flyout menu is still dark

I forget if this one's been around for a while, or if the fix is to apply the theme manually to the entire visual tree.

Note: OS theme is dark

@carlos-zamora carlos-zamora removed their assignment Jan 10, 2023
@zadjii-msft
Copy link
Member Author

or if the fix is to apply the theme manually to the entire visual tree

probably that.... yea. Uhg. I'll take another spin through that and find the popup root.

@zadjii-msft zadjii-msft added this to the Terminal v1.17 milestone Jan 10, 2023
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jan 13, 2023
@ghost
Copy link

ghost commented Jan 13, 2023

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@zadjii-msft
Copy link
Member Author

I'll take another spin through that and find the popup root

This might be Hard to do generically. Consider the code we use for the popups:

        auto themingLambda{ [this](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
            auto theme{ _settings.GlobalSettings().CurrentTheme() };
            auto requestedTheme{ theme.RequestedTheme() };
            auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
            while (element)
            {
                element.RequestedTheme(requestedTheme);
                element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
            }
        } };

Popups belong to a different XAML root than the rest of the app. So we can go up the tree from the SUI and apply the requested theme to that whole tree, but we'll never get up to the popup root from the SUI. We'd need a literal popup to get there, and that we won't have access to, till it's opened.

I'm inclined to resolve that sub-point as "meh". There may be a way to get to it, but "meh".

@ghost ghost merged commit c79298d into main Jan 18, 2023
@ghost ghost deleted the dev/migrie/b/14559-sui-theme-lookup branch January 18, 2023 18:31
@carlos-zamora
Copy link
Member

I'll take another spin through that and find the popup root

This might be Hard to do generically. Consider the code we use for the popups:

        auto themingLambda{ [this](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
            auto theme{ _settings.GlobalSettings().CurrentTheme() };
            auto requestedTheme{ theme.RequestedTheme() };
            auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
            while (element)
            {
                element.RequestedTheme(requestedTheme);
                element = element.Parent().try_as<winrt::Windows::UI::Xaml::FrameworkElement>();
            }
        } };

Popups belong to a different XAML root than the rest of the app. So we can go up the tree from the SUI and apply the requested theme to that whole tree, but we'll never get up to the popup root from the SUI. We'd need a literal popup to get there, and that we won't have access to, till it's opened.

I'm inclined to resolve that sub-point as "meh". There may be a way to get to it, but "meh".

Could it be a part of the SettingContainer? Maybe in OnApplyTemplate()?

Regardless, I'm ok with shipping this as-is. But we should have a bug tracking it imo :/

@carlos-zamora carlos-zamora removed their assignment Jan 18, 2023
@DHowett
Copy link
Member

DHowett commented Jan 18, 2023

Could it be a part of the SettingContainer? Maybe in OnApplyTemplate()?

There's no popup when the template is applied; it only exists when the user interacts. I think this is a very deep well and a big waste of engineering effort to fix honestly. XAML has let us down. :)

@carlos-zamora
Copy link
Member

Could it be a part of the SettingContainer? Maybe in OnApplyTemplate()?

There's no popup when the template is applied; it only exists when the user interacts. I think this is a very deep well and a big waste of engineering effort to fix honestly. XAML has let us down. :)

Oh right, I forgot Mike said that. Fair enough.

@ghost
Copy link

ghost commented Jan 24, 2023

🎉Windows Terminal Preview v1.17.1023 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings UI Anything specific to the SUI AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.17] Setting app theme results in mismatched light/dark colors for SUI text
3 participants