improve:主题

This commit is contained in:
2025-10-04 17:14:14 +08:00
parent b03b8da586
commit e81198165b
2 changed files with 14 additions and 9 deletions
+4 -4
View File
@@ -2855,24 +2855,24 @@ namespace Ink_Canvas
switch (themeIndex) switch (themeIndex)
{ {
case 0: // 浅色主题 case 0: // 浅色主题
SetTheme("Light"); SetTheme("Light", true);
// 浅色主题下设置浮动栏为完全不透明 // 浅色主题下设置浮动栏为完全不透明
ViewboxFloatingBar.Opacity = 1.0; ViewboxFloatingBar.Opacity = 1.0;
break; break;
case 1: // 深色主题 case 1: // 深色主题
SetTheme("Dark"); SetTheme("Dark", true);
// 深色主题下设置浮动栏为完全不透明 // 深色主题下设置浮动栏为完全不透明
ViewboxFloatingBar.Opacity = 1.0; ViewboxFloatingBar.Opacity = 1.0;
break; break;
case 2: // 跟随系统 case 2: // 跟随系统
if (IsSystemThemeLight()) if (IsSystemThemeLight())
{ {
SetTheme("Light"); SetTheme("Light", true);
ViewboxFloatingBar.Opacity = 1.0; ViewboxFloatingBar.Opacity = 1.0;
} }
else else
{ {
SetTheme("Dark"); SetTheme("Dark", true);
ViewboxFloatingBar.Opacity = 1.0; ViewboxFloatingBar.Opacity = 1.0;
} }
break; break;
+10 -5
View File
@@ -12,7 +12,7 @@ namespace Ink_Canvas
{ {
private Color FloatBarForegroundColor; private Color FloatBarForegroundColor;
private void SetTheme(string theme) private void SetTheme(string theme, bool autoSwitchIcon = false)
{ {
// 清理现有的主题资源 // 清理现有的主题资源
var resourcesToRemove = new List<ResourceDictionary>(); var resourcesToRemove = new List<ResourceDictionary>();
@@ -56,8 +56,11 @@ namespace Ink_Canvas
// 刷新快速面板图标 // 刷新快速面板图标
RefreshQuickPanelIcons(); RefreshQuickPanelIcons();
AutoSwitchFloatingBarIconForTheme("Light"); if (autoSwitchIcon)
{
AutoSwitchFloatingBarIconForTheme("Light");
}
// 强制刷新UI // 强制刷新UI
window.InvalidateVisual(); window.InvalidateVisual();
@@ -87,8 +90,10 @@ namespace Ink_Canvas
// 刷新快速面板图标 // 刷新快速面板图标
RefreshQuickPanelIcons(); RefreshQuickPanelIcons();
// 自动切换浮动栏图标为深色呼吸版图标 if (autoSwitchIcon)
AutoSwitchFloatingBarIconForTheme("Dark"); {
AutoSwitchFloatingBarIconForTheme("Dark");
}
// 强制刷新UI // 强制刷新UI
window.InvalidateVisual(); window.InvalidateVisual();