mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-13 13:13:48 +00:00
Added color themes (dark & light) (#148)
This commit is contained in:
1 parent
0ad7b8d4dd
commit
e9998348c5
31 files changed
+350
-50
No files matched your search
@@ -170,4 +170,10 @@ public static class ConfigurationSelectDataFactory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<ConfigurationSelectData<Themes>> GetThemesData()
|
||||
{
|
||||
foreach (var theme in Enum.GetValues<Themes>())
|
||||
yield return new(theme.GetName(), theme);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,11 @@ namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public sealed class DataApp
|
||||
{
|
||||
/// <summary>
|
||||
/// The preferred theme to use.
|
||||
/// </summary>
|
||||
public Themes PreferredTheme { get; set; } = Themes.SYSTEM;
|
||||
|
||||
/// <summary>
|
||||
/// Should we save energy? When true, we will update content streamed
|
||||
/// from the server, i.e., AI, less frequently.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public enum Themes
|
||||
{
|
||||
SYSTEM = 0,
|
||||
LIGHT,
|
||||
DARK,
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace AIStudio.Settings.DataModel;
|
||||
|
||||
public static class ThemesExtensions
|
||||
{
|
||||
public static string GetName(this Themes theme)
|
||||
{
|
||||
return theme switch
|
||||
{
|
||||
Themes.SYSTEM => "Synchronized with the operating system settings",
|
||||
Themes.LIGHT => "Always use light theme",
|
||||
Themes.DARK => "Always use dark theme",
|
||||
|
||||
_ => "Unknown setting",
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public sealed class SettingsManager(ILogger<SettingsManager> logger)
|
||||
Converters = { new JsonStringEnumConverter() },
|
||||
};
|
||||
|
||||
private ILogger<SettingsManager> logger = logger;
|
||||
private readonly ILogger<SettingsManager> logger = logger;
|
||||
|
||||
/// <summary>
|
||||
/// The directory where the configuration files are stored.
|
||||
@@ -33,6 +33,11 @@ public sealed class SettingsManager(ILogger<SettingsManager> logger)
|
||||
/// </summary>
|
||||
public static string? DataDirectory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the app is in dark mode.
|
||||
/// </summary>
|
||||
public bool IsDarkMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The configuration data.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user