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

Add a setting for the unfocused tabRow background color #13049

Merged
73 commits merged into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
15e4fd9
Settings project builds at least
zadjii-msft Mar 24, 2022
7e0ae35
this fixes the App bits as well
zadjii-msft Mar 24, 2022
00c135b
on reload, this changes the BG of the titlebar, but not the tab view
zadjii-msft Mar 24, 2022
b4cd7b3
this is better. Apphost is gonna need to be involved anyways so fuck it
zadjii-msft Mar 24, 2022
9627483
okay so i bet that resource changed. Whatever, we'll work with it.
zadjii-msft Mar 24, 2022
84805f5
dumbly accept alpha channel in colors
zadjii-msft Mar 24, 2022
9670d13
mica works, but the titlebar looks DUMB
zadjii-msft Mar 24, 2022
c555e6e
this did seem to work, but will it work for acrylic?
zadjii-msft Mar 25, 2022
01f07be
okay so you can't change a solid brush to an acylic one at runtime
zadjii-msft Mar 25, 2022
ee9333a
A pile of dead ends.
zadjii-msft Mar 25, 2022
9eff0a2
i feel like I'm getting closer
zadjii-msft Mar 25, 2022
44112fc
really, no good progress here. It's rough
zadjii-msft Mar 28, 2022
f92724d
We can't be clever here. Just make an observable property and slam th…
zadjii-msft Apr 25, 2022
cd0012a
guess what, it works
zadjii-msft Apr 25, 2022
ac49459
change color based on if the window is activated or now
zadjii-msft Apr 26, 2022
03211c8
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/themin…
zadjii-msft Apr 26, 2022
1d0a5d7
Merge remote-tracking branch 'origin/dev/migrie/titebar-colors' into …
zadjii-msft Apr 26, 2022
e22046f
accept accent color as a ThemeColor
zadjii-msft Apr 26, 2022
99dc75d
this actually works now. Remember kids, break statements in switch/ca…
zadjii-msft Apr 26, 2022
a7ce860
cleanup, works on start and when unset
zadjii-msft Apr 26, 2022
4f42661
Lookup themes from a list of themes, use that one to style the window
zadjii-msft Apr 26, 2022
5081118
This is horrifying and yet I'm totally shipping it. Move the objects …
zadjii-msft Apr 26, 2022
fe26114
better, better,
zadjii-msft Apr 26, 2022
7fcfda3
wow
zadjii-msft Apr 26, 2022
df0efff
stragglers
zadjii-msft Apr 26, 2022
7243603
hey this is easier
zadjii-msft Apr 26, 2022
606db76
this is like 99% of the work here
zadjii-msft Apr 26, 2022
de22df0
switches when a tab does, not the pane
zadjii-msft Apr 26, 2022
01d6907
I think that's everything
zadjii-msft Apr 26, 2022
39b6fdd
Some minor todos
zadjii-msft Apr 26, 2022
9bebb74
Some settings saving roundtripping bugs
zadjii-msft Apr 27, 2022
cfb99d9
Change theme with the SUI and actually have it persist
zadjii-msft Apr 27, 2022
a57187b
include the themes
zadjii-msft Apr 27, 2022
b6b9aea
Use better display names
zadjii-msft Apr 27, 2022
e2318b4
This is horrifying
zadjii-msft Apr 27, 2022
bc8bb8e
more comments
zadjii-msft Apr 27, 2022
446e17b
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/themin…
zadjii-msft Apr 27, 2022
fd2dd3a
cleanup for the review
zadjii-msft Apr 27, 2022
a1ea0fd
forgot you
zadjii-msft Apr 28, 2022
9b9a644
spell
zadjii-msft Apr 28, 2022
03da3b7
runformat
zadjii-msft Apr 28, 2022
24f945a
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/themin…
zadjii-msft Apr 29, 2022
3281a3a
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/themin…
zadjii-msft May 3, 2022
68d70a0
this is REALLY janky but seems to work
zadjii-msft May 3, 2022
99bc963
this is simpler
zadjii-msft May 3, 2022
6c28ba6
make the code a lot cleaner
zadjii-msft May 3, 2022
342eb2b
Removes the ability to add Mica in the titlebar, but good enough for v0
zadjii-msft May 4, 2022
cd2fd43
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/themin…
zadjii-msft May 5, 2022
44319a1
Fixes the Settings UI terminalBackground settings
zadjii-msft May 5, 2022
d73e450
this fixes the terminalBG + runtime change
zadjii-msft May 5, 2022
e52b7a9
well, this was part of it...
zadjii-msft May 5, 2022
3af471a
derp
zadjii-msft May 5, 2022
b2abca6
Add comments
zadjii-msft May 6, 2022
ebe80cd
Try to implement unfocusedBackground, find all sorts of serialization…
zadjii-msft May 6, 2022
233f6dd
Start by just adding a test file
zadjii-msft May 6, 2022
207f423
Fill in more tests
zadjii-msft May 6, 2022
b61b0b6
This is what I was looking for
zadjii-msft May 6, 2022
8a02e97
Fix having a null window, cause that was actually very possible
zadjii-msft May 6, 2022
cae5218
Start by just adding a test file
zadjii-msft May 6, 2022
45fb4b1
Fill in more tests
zadjii-msft May 6, 2022
28119c7
This is what I was looking for
zadjii-msft May 6, 2022
2712e46
Fix having a null window, cause that was actually very possible
zadjii-msft May 6, 2022
d770bfe
Merge branch 'dev/migrie/fhl/theming-2022-prototype' into dev/migrie/…
zadjii-msft May 6, 2022
331b98f
sensible defaults
zadjii-msft May 6, 2022
f38dc5c
typos
zadjii-msft May 6, 2022
cb788b0
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/themin…
zadjii-msft May 6, 2022
dd02f9f
Merge branch 'dev/migrie/fhl/theming-2022-prototype' into dev/migrie/…
zadjii-msft May 9, 2022
f5007fa
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/themin…
zadjii-msft May 25, 2022
623c1d6
Merge branch 'dev/migrie/fhl/theming-2022-prototype' into dev/migrie/…
zadjii-msft May 25, 2022
45c6239
this is not idomatic at all
zadjii-msft May 26, 2022
5efbb4d
Merge branch 'main' into dev/migrie/f/unfocused-tabRow-bg
zadjii-msft Jul 7, 2022
bcab4d3
a comment
zadjii-msft Jul 7, 2022
32ea170
how the
zadjii-msft Jul 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4101,24 +4101,27 @@ namespace winrt::TerminalApp::implementation

TitlebarBrush(acrylicBrush);
}
else if (theme.TabRow() && theme.TabRow().Background())
else if (theme.TabRow())
{
const auto tabRowBg = theme.TabRow().Background();
const auto terminalBrush = [this]() -> Media::Brush {
if (const auto& control{ _GetActiveControl() })
{
return control.BackgroundBrush();
}
else if (auto settingsTab = _GetFocusedTab().try_as<TerminalApp::SettingsTab>())
{
return settingsTab.Content().try_as<Settings::Editor::MainPage>().BackgroundBrush();
}
return nullptr;
}();
if (const auto tabRowBg{ _activated ? theme.TabRow().Background() :
theme.TabRow().UnfocusedBackground() })
{
const auto terminalBrush = [this]() -> Media::Brush {
if (const auto& control{ _GetActiveControl() })
{
return control.BackgroundBrush();
}
else if (auto settingsTab = _GetFocusedTab().try_as<TerminalApp::SettingsTab>())
{
return settingsTab.Content().try_as<Settings::Editor::MainPage>().BackgroundBrush();
}
return nullptr;
}();

const auto themeBrush{ tabRowBg.Evaluate(res, terminalBrush, true) };
bgColor = ThemeColor::ColorFromBrush(themeBrush);
TitlebarBrush(themeBrush);
const auto themeBrush{ tabRowBg.Evaluate(res, terminalBrush, true) };
bgColor = ThemeColor::ColorFromBrush(themeBrush);
TitlebarBrush(themeBrush);
}
}
else
{
Expand Down
5 changes: 3 additions & 2 deletions src/cascadia/TerminalSettingsModel/MTSMSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ Author(s):
X(winrt::Windows::UI::Xaml::ElementTheme, RequestedTheme, "applicationTheme", winrt::Windows::UI::Xaml::ElementTheme::Default) \
X(bool, UseMica, "useMica", false)

#define MTSM_THEME_TABROW_SETTINGS(X) \
X(winrt::Microsoft::Terminal::Settings::Model::ThemeColor, Background, "background", nullptr)
#define MTSM_THEME_TABROW_SETTINGS(X) \
X(winrt::Microsoft::Terminal::Settings::Model::ThemeColor, Background, "background", nullptr) \
X(winrt::Microsoft::Terminal::Settings::Model::ThemeColor, UnfocusedBackground, "unfocusedBackground", nullptr)

#define MTSM_THEME_TAB_SETTINGS(X) \
X(winrt::Microsoft::Terminal::Settings::Model::ThemeColor, Background, "background", nullptr)
4 changes: 4 additions & 0 deletions src/cascadia/TerminalSettingsModel/Theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ winrt::WUX::Media::Brush ThemeColor::Evaluate(const winrt::WUX::ResourceDictiona
{
case ThemeColorType::Accent:
{
// NOTE: There is no canonical way to get the unfocused ACCENT titlebar
// color in Windows. Edge uses it's own heuristic, and in Windows 11,
// much of this logic is rapidly changing. We're not gonna mess with
// that, since it seems there's no good way to reverse engineer that.
Comment on lines +107 to +110
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should // TODO GH# this to track it?

Copy link
Member

Choose a reason for hiding this comment

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

agree

Copy link
Member Author

Choose a reason for hiding this comment

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

All the recommendations I got officially were basically "don't even try this", so I'm inclined to just say "nah". Filing an issue would result in it just being wont-fix'ed immediately (IMO)

til::color accentColor = forTitlebar ?
_getAccentColorForTitlebar() :
til::color{ winrt::unbox_value<winrt::Windows::UI::Color>(res.Lookup(accentColorKey)) };
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalSettingsModel/Theme.idl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace Microsoft.Terminal.Settings.Model

runtimeclass TabRowTheme {
ThemeColor Background { get; };
ThemeColor UnfocusedBackground { get; };
}

runtimeclass TabTheme {
Expand Down