From 6ad6ff7fb6e161586ed08fc16bed8fee546bfeb5 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Fri, 2 Jul 2021 12:24:49 +0200 Subject: [PATCH] Changed from brush to opacity (#11843) Co-authored-by: Niels Laute --- .../Microsoft.PowerToys.Settings.UI/App.xaml | 8 +-- .../ModuleEnabledToForegroundConverter.cs | 49 ------------------- .../ModuleEnabledToOpacityConverter.cs | 32 ++++++++++++ .../Microsoft.PowerToys.Settings.UI.csproj | 2 +- .../Views/AwakePage.xaml | 4 +- .../Views/ColorPickerPage.xaml | 10 ++-- .../Views/FancyZonesPage.xaml | 20 ++++---- .../Views/GeneralPage.xaml | 30 ++++++------ .../Views/ImageResizerPage.xaml | 8 +-- .../Views/KeyboardManagerPage.xaml | 8 +-- .../Views/PowerLauncherPage.xaml | 14 +++--- .../Views/PowerPreviewPage.xaml | 8 +-- .../Views/PowerRenamePage.xaml | 6 +-- .../Views/ShortcutGuidePage.xaml | 10 ++-- 14 files changed, 93 insertions(+), 116 deletions(-) delete mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs create mode 100644 src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToOpacityConverter.cs diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml index 8427250f74..a9c21f7bac 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/App.xaml @@ -17,13 +17,7 @@ - - - #66FFFFFF - #FFFFFFFF - - #66000000 - #FF000000 + \ No newline at end of file diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs deleted file mode 100644 index 88dad5aec6..0000000000 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToForegroundConverter.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation -// The Microsoft Corporation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Media; - -namespace Microsoft.PowerToys.Settings.UI.Converters -{ - public sealed class ModuleEnabledToForegroundConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, string language) - { - bool isEnabled = (bool)value; - - if (App.IsDarkTheme()) - { - // DARK - if (isEnabled) - { - return (SolidColorBrush)Application.Current.Resources["DarkForegroundBrush"]; - } - else - { - return (SolidColorBrush)Application.Current.Resources["DarkForegroundDisabledBrush"]; - } - } - else - { - // LIGHT - if (isEnabled) - { - return (SolidColorBrush)Application.Current.Resources["LightForegroundBrush"]; - } - else - { - return (SolidColorBrush)Application.Current.Resources["LightForegroundDisabledBrush"]; - } - } - } - - public object ConvertBack(object value, Type targetType, object parameter, string language) - { - return value; - } - } -} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToOpacityConverter.cs b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToOpacityConverter.cs new file mode 100644 index 0000000000..0bfae0a848 --- /dev/null +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Converters/ModuleEnabledToOpacityConverter.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Media; + +namespace Microsoft.PowerToys.Settings.UI.Converters +{ + public sealed class ModuleEnabledToOpacityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + bool isEnabled = (bool)value; + if (isEnabled) + { + return 1.0; + } + else + { + return 0.4; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + return value; + } + } +} diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj index 39d1db30dd..14218107ca 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Microsoft.PowerToys.Settings.UI.csproj @@ -106,7 +106,7 @@ ShortcutVisualControl.xaml - + diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/AwakePage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/AwakePage.xaml index aff267678d..b6793d6e35 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/AwakePage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/AwakePage.xaml @@ -57,7 +57,7 @@ + Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}" /> diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml index 5943a373b9..1cea6a7622 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/ColorPickerPage.xaml @@ -58,7 +58,7 @@ + Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/> + Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/> + Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/> + Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}" /> diff --git a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml index a42baf17c5..45a130cce1 100644 --- a/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml +++ b/src/settings-ui/Microsoft.PowerToys.Settings.UI/Views/FancyZonesPage.xaml @@ -65,7 +65,7 @@ + Opacity="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled, Converter={StaticResource ModuleEnabledToOpacityConverter}}"/>