add:主题切换

This commit is contained in:
2025-09-21 02:05:49 +08:00
parent 7c8281eb00
commit 0cb4749cf3
3 changed files with 107 additions and 40 deletions
+1 -1
View File
@@ -6291,7 +6291,7 @@
<Border ClipToBounds="True" Name="BoardBorderRightPageListView" <Border ClipToBounds="True" Name="BoardBorderRightPageListView"
Margin="-138,-465,-56,50" Margin="-138,-465,-56,50"
CornerRadius="8" CornerRadius="8"
Background="{DynamicResource FloatBarBackground}" Opacity="1" BorderBrush="#a1a1aa" Background="{DynamicResource FloatBarBackground}" Opacity="1" BorderBrush="{DynamicResource BoardFloatBarBorderBrush}"
BorderThickness="1"> BorderThickness="1">
<ui:ScrollViewerEx Name="BlackBoardRightSidePageListScrollViewer" <ui:ScrollViewerEx Name="BlackBoardRightSidePageListScrollViewer"
Height="460" Height="460"
+26 -13
View File
@@ -31,25 +31,25 @@ namespace Ink_Canvas
Application.Current.Resources.MergedDictionaries.Remove(dict); Application.Current.Resources.MergedDictionaries.Remove(dict);
} }
// 先添加其他资源
var rd2 = new ResourceDictionary
{ Source = new Uri("Resources/DrawShapeImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd2);
var rd3 = new ResourceDictionary
{ Source = new Uri("Resources/SeewoImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd3);
var rd4 = new ResourceDictionary
{ Source = new Uri("Resources/IconImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd4);
if (theme == "Light") if (theme == "Light")
{ {
var rd1 = new ResourceDictionary var rd1 = new ResourceDictionary
{ Source = new Uri("Resources/Styles/Light.xaml", UriKind.Relative) }; { Source = new Uri("Resources/Styles/Light.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd1); Application.Current.Resources.MergedDictionaries.Add(rd1);
// 在主题资源之后添加其他资源
var rd2 = new ResourceDictionary
{ Source = new Uri("Resources/DrawShapeImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd2);
var rd3 = new ResourceDictionary
{ Source = new Uri("Resources/SeewoImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd3);
var rd4 = new ResourceDictionary
{ Source = new Uri("Resources/IconImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd4);
ThemeManager.SetRequestedTheme(window, ElementTheme.Light); ThemeManager.SetRequestedTheme(window, ElementTheme.Light);
InitializeFloatBarForegroundColor(); InitializeFloatBarForegroundColor();
@@ -62,6 +62,19 @@ namespace Ink_Canvas
var rd1 = new ResourceDictionary { Source = new Uri("Resources/Styles/Dark.xaml", UriKind.Relative) }; var rd1 = new ResourceDictionary { Source = new Uri("Resources/Styles/Dark.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd1); Application.Current.Resources.MergedDictionaries.Add(rd1);
// 在主题资源之后添加其他资源
var rd2 = new ResourceDictionary
{ Source = new Uri("Resources/DrawShapeImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd2);
var rd3 = new ResourceDictionary
{ Source = new Uri("Resources/SeewoImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd3);
var rd4 = new ResourceDictionary
{ Source = new Uri("Resources/IconImageDictionary.xaml", UriKind.Relative) };
Application.Current.Resources.MergedDictionaries.Add(rd4);
ThemeManager.SetRequestedTheme(window, ElementTheme.Dark); ThemeManager.SetRequestedTheme(window, ElementTheme.Dark);
InitializeFloatBarForegroundColor(); InitializeFloatBarForegroundColor();
+80 -26
View File
@@ -84,11 +84,23 @@ namespace Ink_Canvas
EnableTwoFingerGestureBtn.Source = EnableTwoFingerGestureBtn.Source =
new BitmapImage(new Uri("/Resources/new-icons/gesture.png", UriKind.Relative)); new BitmapImage(new Uri("/Resources/new-icons/gesture.png", UriKind.Relative));
BoardGesture.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245)); // 根据主题设置颜色
BoardGestureGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); if (Settings.Appearance.Theme == 1) // 深色主题
BoardGestureGeometry2.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); {
BoardGestureLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardGesture.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170)); BoardGestureGeometry.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardGestureGeometry2.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardGestureLabel.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(85, 85, 85));
}
else // 浅色主题或跟随系统
{
BoardGesture.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245));
BoardGestureGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardGestureGeometry2.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardGestureLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170));
}
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon); BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon);
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z"); BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z");
@@ -122,11 +134,23 @@ namespace Ink_Canvas
EnableTwoFingerGestureBtn.Source = EnableTwoFingerGestureBtn.Source =
new BitmapImage(new Uri("/Resources/new-icons/gesture.png", UriKind.Relative)); new BitmapImage(new Uri("/Resources/new-icons/gesture.png", UriKind.Relative));
BoardGesture.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245)); // 根据主题设置颜色
BoardGestureGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); if (Settings.Appearance.Theme == 1) // 深色主题
BoardGestureGeometry2.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); {
BoardGestureLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardGesture.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170)); BoardGestureGeometry.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardGestureGeometry2.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardGestureLabel.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(85, 85, 85));
}
else // 浅色主题或跟随系统
{
BoardGesture.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245));
BoardGestureGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardGestureGeometry2.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardGestureLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardGesture.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170));
}
BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon); BoardGestureGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.DisabledGestureIcon);
BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z"); BoardGestureGeometry2.Geometry = Geometry.Parse("F0 M24,24z M0,0z");
} }
@@ -417,18 +441,37 @@ namespace Ink_Canvas
LassoSelectIconGeometry.Brush = new SolidColorBrush(FloatBarForegroundColor); LassoSelectIconGeometry.Brush = new SolidColorBrush(FloatBarForegroundColor);
LassoSelectIconGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.LinedLassoSelectIcon); LassoSelectIconGeometry.Geometry = Geometry.Parse(XamlGraphicsIconGeometries.LinedLassoSelectIcon);
BoardPen.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245)); // 根据主题设置颜色
BoardSelect.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245)); if (Settings.Appearance.Theme == 1) // 深色主题
BoardEraser.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245)); {
BoardSelectGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardPen.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
BoardPenGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardSelect.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
BoardEraserGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardEraser.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
BoardPenLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardSelectGeometry.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardSelectLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardPenGeometry.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardEraserLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardEraserGeometry.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardSelect.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170)); BoardPenLabel.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardEraser.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170)); BoardSelectLabel.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170)); BoardEraserLabel.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardSelect.BorderBrush = new SolidColorBrush(Color.FromRgb(85, 85, 85));
BoardEraser.BorderBrush = new SolidColorBrush(Color.FromRgb(85, 85, 85));
BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(85, 85, 85));
}
else // 浅色主题或跟随系统
{
BoardPen.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245));
BoardSelect.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245));
BoardEraser.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245));
BoardSelectGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardPenGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardEraserGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardPenLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardSelectLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardEraserLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardSelect.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170));
BoardEraser.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170));
BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170));
}
HideFloatingBarHighlight(); HideFloatingBarHighlight();
} }
@@ -492,10 +535,21 @@ namespace Ink_Canvas
CursorIconGeometry.Brush = new SolidColorBrush(Color.FromRgb(30, 58, 138)); CursorIconGeometry.Brush = new SolidColorBrush(Color.FromRgb(30, 58, 138));
CursorIconGeometry.Geometry = CursorIconGeometry.Geometry =
Geometry.Parse(XamlGraphicsIconGeometries.LinedCursorIcon); Geometry.Parse(XamlGraphicsIconGeometries.LinedCursorIcon);
BoardPen.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245)); // 根据主题设置颜色
BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170)); if (Settings.Appearance.Theme == 1) // 深色主题
BoardPenGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27)); {
BoardPenLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27)); BoardPen.Background = new SolidColorBrush(Color.FromRgb(42, 42, 42));
BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(85, 85, 85));
BoardPenGeometry.Brush = new SolidColorBrush(Color.FromRgb(255, 255, 255));
BoardPenLabel.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
}
else // 浅色主题或跟随系统
{
BoardPen.Background = new SolidColorBrush(Color.FromRgb(244, 244, 245));
BoardPen.BorderBrush = new SolidColorBrush(Color.FromRgb(161, 161, 170));
BoardPenGeometry.Brush = new SolidColorBrush(Color.FromRgb(24, 24, 27));
BoardPenLabel.Foreground = new SolidColorBrush(Color.FromRgb(24, 24, 27));
}
SetFloatingBarHighlightPosition("cursor"); SetFloatingBarHighlightPosition("cursor");
break; break;