Skip to content

Commit 745f7e3

Browse files
committed
Dark and Light Profile Icons
This commit adds the ability to swap between dark and light icons for a profile, this is a additive change so you can either keep using the string icon or you can now swap to a object form in which you specify a light property for light theme and dark for dark theme
1 parent fc0a06c commit 745f7e3

22 files changed

+251
-20
lines changed

src/cascadia/TerminalApp/IPaneContent.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace TerminalApp
3636

3737
void Focus(Windows.UI.Xaml.FocusState reason);
3838

39+
void IconRefresh();
3940
void Close();
4041

4142
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> CloseRequested;

src/cascadia/TerminalApp/MarkdownPaneContent.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ namespace winrt::TerminalApp::implementation
183183
return *this;
184184
}
185185

186+
// Does nothing as Icon doesn't need to be refreshed for MarkdownPaneContent
187+
void MarkdownPaneContent::IconRefresh() noexcept
188+
{
189+
}
190+
186191
void MarkdownPaneContent::Close()
187192
{
188193
CloseRequested.raise(*this, nullptr);

src/cascadia/TerminalApp/MarkdownPaneContent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace winrt::TerminalApp::implementation
3737
uint64_t TaskbarProgress() { return 0; }
3838
bool ReadOnly() { return false; }
3939
winrt::hstring Icon() const;
40+
void IconRefresh() noexcept;
4041
Windows::Foundation::IReference<winrt::Windows::UI::Color> TabColor() const noexcept { return nullptr; }
4142
winrt::Windows::UI::Xaml::Media::Brush BackgroundBrush() { return Background(); }
4243

src/cascadia/TerminalApp/ScratchpadContent.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ namespace winrt::TerminalApp::implementation
5353
return BaseContentArgs(L"scratchpad");
5454
}
5555

56+
// No refresh has to occur for ScratchpadContent so no implementation
57+
void ScratchpadContent::IconRefresh() noexcept
58+
{
59+
}
60+
5661
winrt::hstring ScratchpadContent::Icon() const
5762
{
5863
static constexpr std::wstring_view glyph{ L"\xe70b" }; // QuickNote

src/cascadia/TerminalApp/ScratchpadContent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace winrt::TerminalApp::implementation
2727
uint64_t TaskbarProgress() { return 0; }
2828
bool ReadOnly() { return false; }
2929
winrt::hstring Icon() const;
30+
void IconRefresh() noexcept;
3031
Windows::Foundation::IReference<winrt::Windows::UI::Color> TabColor() const noexcept { return nullptr; }
3132
winrt::Windows::UI::Xaml::Media::Brush BackgroundBrush();
3233

src/cascadia/TerminalApp/SettingsPaneContent.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ namespace winrt::TerminalApp::implementation
6161
return winrt::hstring{ glyph };
6262
}
6363

64+
// No need to perform an icon refresh here
65+
void SettingsPaneContent::IconRefresh() noexcept
66+
{
67+
}
68+
6469
Windows::Foundation::IReference<winrt::Windows::UI::Color> SettingsPaneContent::TabColor() const noexcept
6570
{
6671
return nullptr;

src/cascadia/TerminalApp/SettingsPaneContent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace winrt::TerminalApp::implementation
2828
uint64_t TaskbarProgress() { return 0; }
2929
bool ReadOnly() { return false; }
3030
winrt::hstring Icon() const;
31+
void IconRefresh() noexcept;
3132
Windows::Foundation::IReference<winrt::Windows::UI::Color> TabColor() const noexcept;
3233
winrt::Windows::UI::Xaml::Media::Brush BackgroundBrush();
3334

src/cascadia/TerminalApp/SnippetsPaneContent.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ namespace winrt::TerminalApp::implementation
108108
return winrt::hstring{ glyph };
109109
}
110110

111+
// No need to perform an icon refresh
112+
void SnippetsPaneContent::IconRefresh() noexcept
113+
{
114+
}
115+
111116
winrt::WUX::Media::Brush SnippetsPaneContent::BackgroundBrush()
112117
{
113118
static const auto key = winrt::box_value(L"SettingsUiTabBrush");

src/cascadia/TerminalApp/SnippetsPaneContent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ namespace winrt::TerminalApp::implementation
2929
uint64_t TaskbarProgress() { return 0; }
3030
bool ReadOnly() { return false; }
3131
winrt::hstring Icon() const;
32+
void IconRefresh() noexcept;
3233
Windows::Foundation::IReference<winrt::Windows::UI::Color> TabColor() const noexcept { return nullptr; }
3334
winrt::Windows::UI::Xaml::Media::Brush BackgroundBrush();
3435

src/cascadia/TerminalApp/TabManagement.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,15 @@ namespace winrt::TerminalApp::implementation
222222
// tab's icon to that icon.
223223
// Arguments:
224224
// - tab: the Tab to update the title for.
225-
void TerminalPage::_UpdateTabIcon(TerminalTab& tab)
225+
// - isRefresh: Specified when the Icon is due to refresh due to a update e.g. Windows Theme Color Change, defaults to false
226+
void TerminalPage::_UpdateTabIcon(TerminalTab& tab, bool isRefresh)
226227
{
227228
if (const auto content{ tab.GetActiveContent() })
228229
{
230+
if (isRefresh)
231+
{
232+
content.IconRefresh();
233+
}
229234
const auto& icon{ content.Icon() };
230235
const auto theme = _settings.GlobalSettings().CurrentTheme();
231236
const auto iconStyle = (theme && theme.Tab()) ? theme.Tab().IconStyle() : IconStyle::Default;

0 commit comments

Comments
 (0)