forked from microsoft/terminal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Persist selected color scheme on navigation; Don't gray-out color swa…
…tches (microsoft#8799) ## Summary of the Pull Request This PR fixes two of the components of microsoft#8765. > * [ ] Edit a color scheme -> Hit 'apply' -> the selected color scheme resets to the first color scheme in the list (instead of the one just edited) This was fixed by storing the navigation state as a singleton in MainPage, and having the color schemes page update the selected scheme on that singleton. That way, a subsequent navigation to the schemes page could re-use the existing state. > * [ ] The buttons turn gray on rollover covering up what color I'm looking at (I have dark mode) This one was tricky. We're binding the resource for this button, to the color the button is bound to. We're also running a converter on that color, as to change the alpha slightly. This allows us to still have visual feedback on pointerover, without obscuring the color entirely. ## PR Checklist * [x] I work here * [x] Tested manually
- Loading branch information
1 parent
bb51c1a
commit 1f8e660
Showing
10 changed files
with
166 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/cascadia/TerminalSettingsEditor/ColorLightenConverter.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#include "pch.h" | ||
#include "ColorLightenConverter.h" | ||
#include "ColorLightenConverter.g.cpp" | ||
|
||
using namespace winrt::Windows; | ||
using namespace winrt::Windows::UI; | ||
using namespace winrt::Windows::UI::Xaml; | ||
using namespace winrt::Windows::UI::Text; | ||
|
||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation | ||
{ | ||
Foundation::IInspectable ColorLightenConverter::Convert(Foundation::IInspectable const& value, | ||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */, | ||
Foundation::IInspectable const& /* parameter */, | ||
hstring const& /* language */) | ||
{ | ||
auto original = winrt::unbox_value_or<Color>(value, Color{ 255, 0, 0, 0 }); | ||
auto result = original; | ||
result.A = 128; // halfway transparent | ||
return winrt::box_value(result); | ||
} | ||
|
||
Foundation::IInspectable ColorLightenConverter::ConvertBack(Foundation::IInspectable const& /*value*/, | ||
Windows::UI::Xaml::Interop::TypeName const& /* targetType */, | ||
Foundation::IInspectable const& /*parameter*/, | ||
hstring const& /* language */) | ||
{ | ||
throw hresult_not_implemented(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#pragma once | ||
|
||
#include "ColorLightenConverter.g.h" | ||
#include "../inc/cppwinrt_utils.h" | ||
|
||
DECLARE_CONVERTER(winrt::Microsoft::Terminal::Settings::Editor, ColorLightenConverter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters