diff --git a/v2rayN/ServiceLib/Enums/ETheme.cs b/v2rayN/ServiceLib/Enums/ETheme.cs
new file mode 100644
index 00000000..7701ae8f
--- /dev/null
+++ b/v2rayN/ServiceLib/Enums/ETheme.cs
@@ -0,0 +1,13 @@
+namespace ServiceLib.Enums
+{
+ public enum ETheme
+ {
+ FollowSystem,
+ Dark,
+ Light,
+ Aquatic,
+ Desert,
+ Dusk,
+ NightSky
+ }
+}
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs
index f7642df3..41d34606 100644
--- a/v2rayN/ServiceLib/Models/ConfigItems.cs
+++ b/v2rayN/ServiceLib/Models/ConfigItems.cs
@@ -105,6 +105,7 @@
public bool ColorModeDark { get; set; }
public bool FollowSystemTheme { get; set; }
public string? ColorPrimaryName { get; set; }
+ public string? CurrentTheme { get; set; }
public string CurrentLanguage { get; set; }
public string CurrentFontFamily { get; set; }
public int CurrentFontSize { get; set; }
diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
index abe53603..4cc375a8 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
+++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
@@ -3463,6 +3463,15 @@ namespace ServiceLib.Resx {
}
}
+ ///
+ /// 查找类似 Theme 的本地化字符串。
+ ///
+ public static string TbSettingsTheme {
+ get {
+ return ResourceManager.GetString("TbSettingsTheme", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Enable Security Protocol TLS v1.3 (subscription/update) 的本地化字符串。
///
diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
index e9c4a62b..20f52b3e 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
@@ -1402,4 +1402,7 @@
socks:پورت محلی، socks2: پورت دوم محلی، socks3: پورت LAN
-
+
+ Theme
+
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
index 053efb6a..a66ddedb 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
@@ -1402,4 +1402,7 @@
socks: local port, socks2: second local port, socks3: LAN port
+
+ Theme
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx
index 82b27147..1152a657 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.resx
@@ -1402,4 +1402,7 @@
socks: local port, socks2: second local port, socks3: LAN port
+
+ Theme
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
index 326bf5d3..325e431c 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
@@ -1402,4 +1402,7 @@
socks: local port, socks2: second local port, socks3: LAN port
+
+ Theme
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
index 6807b6de..45dfaca1 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
@@ -1399,4 +1399,7 @@
socks:本地端口,socks2:第二个本地端口,socks3:局域网端口
+
+ 主题
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
index 27d7207b..ff22b92d 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
@@ -1400,4 +1400,7 @@
socks:本地端口,socks2:第二個本地端口,socks3:區域網路端口
+
+ 主題
+
\ No newline at end of file
diff --git a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
index d0854a2f..afdf78c2 100644
--- a/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
+++ b/v2rayN/v2rayN.Desktop/ViewModels/ThemeSettingViewModel.cs
@@ -6,14 +6,14 @@ using Avalonia.Media;
using Avalonia.Styling;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
+using Semi.Avalonia;
using System.Reactive.Linq;
namespace v2rayN.Desktop.ViewModels
{
public class ThemeSettingViewModel : MyReactiveObject
{
- [Reactive] public bool ColorModeDark { get; set; }
- [Reactive] public bool FollowSystemTheme { get; set; }
+ [Reactive] public string CurrentTheme { get; set; }
[Reactive] public int CurrentFontSize { get; set; }
@@ -36,28 +36,16 @@ namespace v2rayN.Desktop.ViewModels
private void BindingUI()
{
- ColorModeDark = _config.UiItem.ColorModeDark;
- FollowSystemTheme = _config.UiItem.FollowSystemTheme;
+ CurrentTheme = _config.UiItem.CurrentTheme;
CurrentFontSize = _config.UiItem.CurrentFontSize;
CurrentLanguage = _config.UiItem.CurrentLanguage;
- this.WhenAnyValue(x => x.ColorModeDark)
+ this.WhenAnyValue(x => x.CurrentTheme)
.Subscribe(c =>
{
- if (_config.UiItem.ColorModeDark != ColorModeDark)
+ if (_config.UiItem.CurrentTheme != CurrentTheme)
{
- _config.UiItem.ColorModeDark = ColorModeDark;
- ModifyTheme();
- ConfigHandler.SaveConfig(_config);
- }
- });
- this.WhenAnyValue(x => x.FollowSystemTheme,
- y => y == true)
- .Subscribe(c =>
- {
- if (_config.UiItem.FollowSystemTheme != FollowSystemTheme)
- {
- _config.UiItem.FollowSystemTheme = FollowSystemTheme;
+ _config.UiItem.CurrentTheme = CurrentTheme;
ModifyTheme();
ConfigHandler.SaveConfig(_config);
}
@@ -96,7 +84,16 @@ namespace v2rayN.Desktop.ViewModels
var app = Application.Current;
if (app is not null)
{
- app.RequestedThemeVariant = FollowSystemTheme ? ThemeVariant.Default : (ColorModeDark ? ThemeVariant.Dark : ThemeVariant.Light);
+ app.RequestedThemeVariant = CurrentTheme switch
+ {
+ nameof(ETheme.Dark) => ThemeVariant.Dark,
+ nameof(ETheme.Light) => ThemeVariant.Light,
+ nameof(ETheme.Aquatic) => SemiTheme.Aquatic,
+ nameof(ETheme.Desert) => SemiTheme.Desert,
+ nameof(ETheme.Dusk) => SemiTheme.Dusk,
+ nameof(ETheme.NightSky) => SemiTheme.NightSky,
+ _ => ThemeVariant.Default,
+ };
}
}
diff --git a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml
index 61c4a778..39f5fffc 100644
--- a/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/ThemeSettingView.axaml
@@ -10,6 +10,15 @@
d:DesignWidth="800"
x:DataType="vms:ThemeSettingViewModel"
mc:Ignorable="d">
+
+
+
+
+