mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 20:57:22 +02:00
[Settings] Fix for theming aware titles (#5245)
* Fix for theming aware titles * Converter fix
This commit is contained in:
@@ -17,6 +17,13 @@
|
|||||||
<ResourceDictionary Source="/Styles/Button.xaml"/>
|
<ResourceDictionary Source="/Styles/Button.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<converters:ModuleEnabledToForegroundConverter x:Key="ModuleEnabledToForegroundConverter"/>
|
<converters:ModuleEnabledToForegroundConverter x:Key="ModuleEnabledToForegroundConverter"/>
|
||||||
|
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="DarkForegroundDisabledBrush">#66FFFFFF</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="DarkForegroundBrush">#FFFFFFFF</SolidColorBrush>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="LightForegroundDisabledBrush">#66000000</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="LightForegroundBrush">#FF000000</SolidColorBrush>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</xaml:XamlApplication>
|
</xaml:XamlApplication>
|
||||||
@@ -1,7 +1,4 @@
|
|||||||
// Copyright (c) Microsoft Corporation
|
using Microsoft.PowerToys.Settings.UI.Lib;
|
||||||
// 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 System;
|
||||||
using Windows.UI;
|
using Windows.UI;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
@@ -15,13 +12,36 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
|
|||||||
public object Convert(object value, Type targetType, object parameter, string language)
|
public object Convert(object value, Type targetType, object parameter, string language)
|
||||||
{
|
{
|
||||||
bool isEnabled = (bool)value;
|
bool isEnabled = (bool)value;
|
||||||
if (isEnabled)
|
GeneralSettings generalSettings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
|
||||||
|
|
||||||
|
var defaultTheme = new Windows.UI.ViewManagement.UISettings();
|
||||||
|
var uiTheme = defaultTheme.GetColorValue(Windows.UI.ViewManagement.UIColorType.Background).ToString();
|
||||||
|
|
||||||
|
string selectedTheme = generalSettings.Theme.ToLower();
|
||||||
|
|
||||||
|
if (selectedTheme == "dark" || (selectedTheme == "system" && uiTheme == "#FF000000"))
|
||||||
{
|
{
|
||||||
return new SolidColorBrush((Color)Application.Current.Resources["SystemBaseHighColor"]);
|
// DARK
|
||||||
|
if (isEnabled)
|
||||||
|
{
|
||||||
|
return (SolidColorBrush)Application.Current.Resources["DarkForegroundBrush"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (SolidColorBrush)Application.Current.Resources["DarkForegroundDisabledBrush"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (SolidColorBrush)Application.Current.Resources["SystemControlDisabledBaseMediumLowBrush"];
|
// LIGHT
|
||||||
|
if (isEnabled)
|
||||||
|
{
|
||||||
|
return (SolidColorBrush)Application.Current.Resources["LightForegroundBrush"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (SolidColorBrush)Application.Current.Resources["LightForegroundDisabledBrush"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user