Add nullable colors and improve Profile.Icon in settings UI#17870
Add nullable colors and improve Profile.Icon in settings UI#17870carlos-zamora merged 21 commits intomainfrom
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.
fwiw if we're adding a static global converter function, we don't need a converter object!
There was a problem hiding this comment.
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 🫤
|
|
||
| <ContentPresenter Grid.Column="0" | ||
| Content="{x:Bind ColorSchemeVM, Mode=OneWay}" | ||
| ContentTemplate="{StaticResource 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:
|
Feedback from Bug Bash (11/19)
|
|
(Code format seems upset) |




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.
Improves the UI for the Profile.Icon setting by adding an "Icon Type" combo box. This allows the user to pick from multiple options:
Additionally, the rendered icon is displayed in the setting container. If "none", "none" is presented to the user (localized).
References and Relevant Issues
#10000
Detailed Description of the Pull Request / Additional comments
ExpanderSettingContainerStyleto 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.CurrentValueproperty fromStringtoIInspectableCurrentValueTemplateproperty to control how to display the current valueBooleanToVisibility,ColorToString,ColorToBrush)NameWithHexCodetoColorTableEntryto 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