mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
HAX SUI: display a border on the color chips if they're not gonna be visible
This commit is contained in:
parent
e97388cb27
commit
5bd5f5cb04
@ -167,6 +167,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
}
|
||||
}
|
||||
|
||||
winrt::Windows::UI::Xaml::Media::Brush ColorSchemeViewModel::MaybeContrastingColor(winrt::Windows::UI::Color color)
|
||||
{
|
||||
winrt::Windows::UI::Xaml::Media::SolidColorBrush scb{};
|
||||
scb.Color(color);
|
||||
if (color == BackgroundColor().Color())
|
||||
{
|
||||
scb.Color(ForegroundColor().Color());
|
||||
}
|
||||
return scb;
|
||||
}
|
||||
|
||||
ColorTableEntry::ColorTableEntry(uint8_t index, Windows::UI::Color color)
|
||||
{
|
||||
static const std::array<hstring, 16> TableColorNames = {
|
||||
|
||||
@ -40,6 +40,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||
|
||||
// DON'T YOU DARE ADD A `WINRT_CALLBACK(PropertyChanged` TO A CLASS DERIVED FROM ViewModelHelper. Do this instead:
|
||||
using ViewModelHelper<ColorSchemeViewModel>::PropertyChanged;
|
||||
winrt::Windows::UI::Xaml::Media::Brush MaybeContrastingColor(winrt::Windows::UI::Color color);
|
||||
|
||||
WINRT_PROPERTY(Windows::Foundation::Collections::IVector<Editor::ColorTableEntry>, NonBrightColorTable, nullptr);
|
||||
WINRT_PROPERTY(Windows::Foundation::Collections::IVector<Editor::ColorTableEntry>, BrightColorTable, nullptr);
|
||||
|
||||
@ -25,6 +25,8 @@ namespace Microsoft.Terminal.Settings.Editor
|
||||
ColorTableEntry CursorColor;
|
||||
ColorTableEntry SelectionBackgroundColor;
|
||||
|
||||
Windows.UI.Xaml.Media.Brush MaybeContrastingColor(Windows.UI.Color color);
|
||||
|
||||
void DeleteConfirmation_Click(IInspectable sender, Windows.UI.Xaml.RoutedEventArgs args);
|
||||
void SetAsDefault_Click(IInspectable sender, Windows.UI.Xaml.RoutedEventArgs args);
|
||||
void Duplicate_Click(IInspectable sender, Windows.UI.Xaml.RoutedEventArgs args);
|
||||
|
||||
@ -21,10 +21,12 @@
|
||||
|
||||
<DataTemplate x:Key="ColorPreviewChipTemplate"
|
||||
x:DataType="local:ColorTableEntry">
|
||||
<Border Width="12"
|
||||
Height="12"
|
||||
<Border Width="11"
|
||||
Height="11"
|
||||
Background="{x:Bind mtu:Converters.ColorToBrush(Color)}"
|
||||
BorderThickness="2"
|
||||
CornerRadius="2" />
|
||||
<!-- BorderBrush="{x:Bind ((local:ColorSchemeViewModel)DataContext).MaybeContrastingColor(Color)}" -->
|
||||
</DataTemplate>
|
||||
|
||||
<Style x:Key="SchemeGridStyle"
|
||||
@ -113,81 +115,97 @@
|
||||
Grid.Column="0"
|
||||
Content="{x:Bind ColorEntryAt(0), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Content="{x:Bind ColorEntryAt(1), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Content="{x:Bind ColorEntryAt(2), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="3"
|
||||
Content="{x:Bind ColorEntryAt(3), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="4"
|
||||
Content="{x:Bind ColorEntryAt(4), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="5"
|
||||
Content="{x:Bind ColorEntryAt(5), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="6"
|
||||
Content="{x:Bind ColorEntryAt(6), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="0"
|
||||
Grid.Column="7"
|
||||
Content="{x:Bind ColorEntryAt(7), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Content="{x:Bind ColorEntryAt(8), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Content="{x:Bind ColorEntryAt(9), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Content="{x:Bind ColorEntryAt(10), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="3"
|
||||
Content="{x:Bind ColorEntryAt(11), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="4"
|
||||
Content="{x:Bind ColorEntryAt(12), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="5"
|
||||
Content="{x:Bind ColorEntryAt(13), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="6"
|
||||
Content="{x:Bind ColorEntryAt(14), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<ContentControl Grid.Row="1"
|
||||
Grid.Column="7"
|
||||
Content="{x:Bind ColorEntryAt(15), Mode=OneWay}"
|
||||
ContentTemplate="{StaticResource ColorPreviewChipTemplate}"
|
||||
DataContext="{x:Bind (local:ColorSchemeViewModel), Mode=OneWay}"
|
||||
IsTabStop="False" />
|
||||
<TextBlock Grid.RowSpan="2"
|
||||
Grid.Column="8"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user