-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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 support for tab.unfocusedBackground
#13689
Conversation
… FG color, works sanely now
…/13684-inactiveTabBg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welp, definitely reviewed this out of order haha. Didn't realize most of the new stuff in TabBase came straight out of TerminalTab. I've got a lot of comments, so I'll circle back to this PR after they're addressed.
// Look through the theme dictionaries we defined: | ||
for (const auto& [dictionaryKey, dict] : dictionary.ThemeDictionaries()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the heuristic is if a Source
isn't defined, we assume it's ours? And we can guarantee that the Source
will always be set by MUX?
Should we go the extra mile and set a source ourselves? Like "TerminalAppResources" or something like that? 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, yea. I don't think mu will ever not set that.
I honestly don't know the right way to set our own source. We're just looking it up out of the App.xaml resources, I'm not sure that gets to have a Source unless we move it to a separate file. idk.
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderBackgroundSelected"), selectedTabBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPointerOver"), hoverTabBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderBackgroundPressed"), selectedTabBrush); | ||
|
||
// Similarly, TabViewItem().Foreground() sets the color for the text | ||
// when the TabViewItem isn't selected, but not when it is hovered, | ||
// pressed, dragged, or selected, so we'll need to just set them all | ||
// anyways. | ||
TabViewItem().Foreground(deselectedFontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForeground"), deselectedFontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundSelected"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundPointerOver"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderForegroundPressed"), fontBrush); | ||
|
||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForeground"), deselectedFontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForegroundPressed"), secondaryFontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonForegroundPointerOver"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderPressedCloseButtonForeground"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderPointerOverCloseButtonForeground"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderSelectedCloseButtonForeground"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPressed"), subtleFillColorTertiaryBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewItemHeaderCloseButtonBackgroundPointerOver"), subtleFillColorSecondaryBrush); | ||
|
||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundActiveTab"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundPressed"), fontBrush); | ||
TabViewItem().Resources().Insert(winrt::box_value(L"TabViewButtonForegroundPointerOver"), fontBrush); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would there be enough benefit to magic static
-ify all of these winrt::box_value(L"<resource name>")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm... The strings also seem to be used below in _ClearTabBackgroundColor
. Maybe we should static
-ify the strings themselves? Idk if/when it's worth it though 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meh we maybe could. This is all copypasta from TerminalTab and this hasn't ever seemed like an issue before.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍
return std::nullopt; | ||
} | ||
|
||
void TabBase::ThemeColor(const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& focused, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
This comment has been minimized.
This comment has been minimized.
[11:48 AM] Leonard Hecker of course not - it's "alpha A inversed" [11:49 AM] Leonard Hecker why is that so hard to understand /s lmao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
The color of inactive tab text is incorrect since #13689 due to the introduction of `til::color::layer_over` which incorrectly calculated the RGB values. ## Validation Steps Performed * Added unit tests ✅ Co-authored-by: Leonard Hecker <lhecker@microsoft.com>
🎉 Handy links: |
Does what it sounds like on the label.
This is important, because when unset, the tab will use the active
Background
color to create an inactive BG, which maybe isn't what we want. Consider:terminalBG
for thetabRow
bg.Without an unfocusedBackground setting, all the tabs will still appear cyan when unfocused, which is extra gross.
As a judgement call, I made
terminalBackground
andaccent
use 30% opacity when set, to match the existing coloration.See also #13554. If we want to make the default theme
tab.background: terminalBackground
, we should maketab.unfocusedBackground
transparent (#00000000
) by default. Otherwise, a Campell (#0c0c0c
) tab on any tab row will still have a faint tab visible.tab.inactiveBackground
) #13684This also does a lot of code shuffling, to get SettingsUI tabs to behave sensibly. We want those tabs to have (
#0c0c0c
,#ffffff
) colored BGs forterminalBackground
(see mail thread).We also don't want dark focused tabs colors, combined with light tab row colors, combined with transparent unfocused tabs, to result in unfocused tabs having white-on-white text. That's gross. So that's been added to this PR in b38b704.