-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 nullable colors to settings UI #17870
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
src/cascadia/TerminalSettingsEditor/TerminalColorConverters.cpp
Outdated
Show resolved
Hide resolved
Windows::Foundation::IInspectable ColorToBrushConverter::Convert(Windows::Foundation::IInspectable const& value, Windows::UI::Xaml::Interop::TypeName const& /*targetType*/, Windows::Foundation::IInspectable const& /*parameter*/, hstring const& /*language*/) | ||
{ | ||
const auto color = value.as<Windows::UI::Color>(); | ||
return Microsoft::Terminal::UI::Converters::ColorToBrush(color); |
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.
fwiw if we're adding a static global converter function, we don't need a converter object!
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.
Omg, yeah, I hate it. I'd rather directly use mtu:Converters.ColorToBrush(<param>)
in the XML, but the problem is here:
<!-- CommonResources.xaml::ColorPreviewTemplate -->
Fill="{Binding Converter={StaticResource ColorToBrushConverter}}"
We don't have a Path set because we want to convert the object itself. Since there isn't a path, there isn't a way to target the object itself (from what I know, at least). Fill="{Binding mtu:Converters.ColorToBrush}"
silently fails (no rendered Rectangle)!
Also, if you're curious, we can't use x:Bind
because XamlCompiler error WMC1119: This Xaml file must have a code-behind class to use {x:Bind}. See http://go.microsoft.com/fwlink/?LinkID=532920&clcid=0x409 for more information
.
Also also, in case you're extra curious, I wasn't able to figure out how to define the DataType as IReference<Core::Color>
because of the IReference
part.
So that's why this part's implemented like this 🫤
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.
UGH. Thanks.
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.
18/26
|
||
<ContentPresenter Grid.Column="0" | ||
Content="{x:Bind ColorSchemeVM, Mode=OneWay}" | ||
ContentTemplate="{StaticResource ColorSchemeTemplate}" /> |
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.
📝 ColorSchemeTemplate?
## Summary of the Pull Request Improves the UI for the Profile.Icon setting by adding an "Icon Type" combo box. This allows the user to pick from multiple options: - None: sets the icon to "none" which is interpreted as no icon - Built-in Icon: presents a combo box that enumerates the Segoe MDL 2 assets - Emoji: presents a text box with a hint to open the emoji picker - File: presents a text box to input the path of the image to use Additionally, the rendered icon is displayed in the setting container. If "none", "none" is presented to the user (localized). ✅ Verified as accessible using Accessibility Insights #10000
Alright! Made some minor changes to fix the focus issue, text box issue, theme issue (on Win10), and layout concerns. Here's a storyboard of the slightly new design: Changes:
|
Summary of the Pull Request
Adds some pre-existing settings ($profile.foreground, $profile.background, $profile.selectionBackground, $profile.cursorColor) to the settings UI. This was accomplished by introducing a new control: NullableColorPicker. This control allows the user to pick a color from the color scheme, set the color to null, and select a color from an advanced color picker.
References and Relevant Issues
#10000
Detailed Description of the Pull Request / Additional comments
ExpanderSettingContainerStyle
to allow for a custom preview template. This way, we can display the current value in the expander and we're not just limited to text.CurrentValue
property fromString
toIInspectable
CurrentValueTemplate
property to control how to display the current valueBooleanToVisibility
,ColorToString
,ColorToBrush
)NameWithHexCode
toColorTableEntry
to expose a color asRed #RRGGBB
(used for tooltips and a11y)ForegroundPreview
(and equivalent for other colors) to AppearanceViewModel to deduce the color that will be usedValidation Steps Performed
Follow-ups