@@ -4689,10 +4689,13 @@ namespace winrt::TerminalApp::implementation
4689
4689
}
4690
4690
4691
4691
const auto theme = _settings.GlobalSettings ().CurrentTheme ();
4692
+ auto paneActiveBorderColor = theme.Pane () ? theme.Pane ().ActiveBorderColor () : nullptr ;
4693
+ auto paneInactiveBorderColor = theme.Pane () ? theme.Pane ().InactiveBorderColor () : nullptr ;
4694
+ auto broadcastBorderColor = theme.Pane () ? theme.Pane ().BroadcastBorderColor () : nullptr ;
4692
4695
auto requestedTheme{ theme.RequestedTheme () };
4693
4696
4694
4697
{
4695
- _updatePaneResources (requestedTheme);
4698
+ _updatePaneResources (requestedTheme, paneActiveBorderColor, paneInactiveBorderColor, broadcastBorderColor );
4696
4699
4697
4700
for (const auto & tab : _tabs)
4698
4701
{
@@ -4803,60 +4806,75 @@ namespace winrt::TerminalApp::implementation
4803
4806
// color of the titlebar)
4804
4807
// Arguments:
4805
4808
// - requestedTheme: this should be the currently active Theme for the app
4809
+ // - activeBorderColor: the pane's border color for the application when it is active
4810
+ // - inactiveBorderColor: the pane's border color for the application when it is inactive
4811
+ // - broadcastBorderColor: the pane's border color for the application when it is broadcast
4806
4812
// Return Value:
4807
4813
// - <none>
4808
- void TerminalPage::_updatePaneResources (const winrt::Windows::UI::Xaml::ElementTheme& requestedTheme)
4814
+ void TerminalPage::_updatePaneResources (const winrt::Windows::UI::Xaml::ElementTheme& requestedTheme, const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& activeBorderColor, const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& inactiveBorderColor, const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& broadcastBorderColor )
4809
4815
{
4810
4816
const auto res = Application::Current ().Resources ();
4811
4817
const auto accentColorKey = winrt::box_value (L" SystemAccentColor" );
4818
+ auto activeBrushColor = Colors::Black (), inactiveBrushColor = Colors::Black (), broadcastBrushColor = Colors::Black ();
4812
4819
if (res.HasKey (accentColorKey))
4813
4820
{
4814
4821
const auto colorFromResources = ThemeLookup (res, requestedTheme, accentColorKey);
4815
4822
// If SystemAccentColor is _not_ a Color for some reason, use
4816
4823
// Transparent as the color, so we don't do this process again on
4817
4824
// the next pane (by leaving s_focusedBorderBrush nullptr)
4818
- auto actualColor = winrt::unbox_value_or<Color>(colorFromResources, Colors::Black ());
4819
- _paneResources.focusedBorderBrush = SolidColorBrush (actualColor);
4820
- }
4821
- else
4825
+ activeBrushColor = winrt::unbox_value_or<Color>(colorFromResources, Colors::Black ());
4826
+ }
4827
+ // Temporary until a suggestion is given to make this nicer (Mutative)
4828
+ auto copyTerminalColorObjToUIColorObj = [](winrt::Windows::UI::Color& colorToModify, const winrt::Microsoft::Terminal::Settings::Model::ThemeColor& colorToCopy) {
4829
+ // There is most likely a way to use unbox_value_or here but when I tried it, it did not work (always gave the OR value), need feedback on how to improve this
4830
+ auto rawColor = colorToCopy.Color ();
4831
+ colorToModify.B = rawColor.B ;
4832
+ colorToModify.R = rawColor.R ;
4833
+ colorToModify.G = rawColor.G ;
4834
+ colorToModify.A = rawColor.A ;
4835
+ };
4836
+ // Overwrites the accent above (or the black default color if there was no accent color)
4837
+ if (activeBorderColor)
4822
4838
{
4823
- // DON'T use Transparent here - if it's "Transparent", then it won't
4824
- // be able to hittest for clicks, and then clicking on the border
4825
- // will eat focus.
4826
- _paneResources.focusedBorderBrush = SolidColorBrush{ Colors::Black () };
4839
+ copyTerminalColorObjToUIColorObj (activeBrushColor, activeBorderColor);
4827
4840
}
4828
-
4841
+ // DON'T use Transparent here - if it's "Transparent", then it won't
4842
+ // be able to hittest for clicks, and then clicking on the border
4843
+ // will eat focus.
4844
+ _paneResources.focusedBorderBrush = SolidColorBrush (activeBrushColor);
4829
4845
const auto unfocusedBorderBrushKey = winrt::box_value (L" UnfocusedBorderBrush" );
4830
4846
if (res.HasKey (unfocusedBorderBrushKey))
4831
4847
{
4832
4848
// MAKE SURE TO USE ThemeLookup, so that we get the correct resource for
4833
4849
// the requestedTheme, not just the value from the resources (which
4834
4850
// might not respect the settings' requested theme)
4835
4851
auto obj = ThemeLookup (res, requestedTheme, unfocusedBorderBrushKey);
4836
- _paneResources. unfocusedBorderBrush = obj.try_as <winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
4852
+ inactiveBrushColor = obj.try_as <winrt::Windows::UI::Xaml::Media::SolidColorBrush>(). Color ();
4837
4853
}
4838
- else
4854
+ // Overwrites the above (or the black default color if there was no unfocusedBorderBrushKey)
4855
+ if (inactiveBorderColor)
4839
4856
{
4840
- // DON'T use Transparent here - if it's "Transparent", then it won't
4841
- // be able to hittest for clicks, and then clicking on the border
4842
- // will eat focus.
4843
- _paneResources.unfocusedBorderBrush = SolidColorBrush{ Colors::Black () };
4857
+ copyTerminalColorObjToUIColorObj (inactiveBrushColor, inactiveBorderColor);
4844
4858
}
4845
-
4859
+ // DON'T use Transparent here - if it's "Transparent", then it won't
4860
+ // be able to hittest for clicks, and then clicking on the border
4861
+ // will eat focus.
4862
+ _paneResources.unfocusedBorderBrush = SolidColorBrush (inactiveBrushColor);
4846
4863
const auto broadcastColorKey = winrt::box_value (L" BroadcastPaneBorderColor" );
4847
4864
if (res.HasKey (broadcastColorKey))
4848
4865
{
4849
4866
// MAKE SURE TO USE ThemeLookup
4850
4867
auto obj = ThemeLookup (res, requestedTheme, broadcastColorKey);
4851
- _paneResources. broadcastBorderBrush = obj.try_as <winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
4868
+ broadcastBrushColor = obj.try_as <winrt::Windows::UI::Xaml::Media::SolidColorBrush>(). Color ();
4852
4869
}
4853
- else
4870
+ if (broadcastBorderColor)
4854
4871
{
4855
- // DON'T use Transparent here - if it's "Transparent", then it won't
4856
- // be able to hittest for clicks, and then clicking on the border
4857
- // will eat focus.
4858
- _paneResources.broadcastBorderBrush = SolidColorBrush{ Colors::Black () };
4872
+ copyTerminalColorObjToUIColorObj (broadcastBrushColor, broadcastBorderColor);
4859
4873
}
4874
+ // DON'T use Transparent here - if it's "Transparent", then it won't
4875
+ // be able to hittest for clicks, and then clicking on the border
4876
+ // will eat focus.
4877
+ _paneResources.broadcastBorderBrush = SolidColorBrush (broadcastBrushColor);
4860
4878
}
4861
4879
4862
4880
void TerminalPage::WindowActivated (const bool activated)
0 commit comments