forked from sim0n00ps/OF-DL
Change the default theme to dark mode
This commit is contained in:
parent
36dbb3de5d
commit
4ae09a5991
@ -1,3 +1,5 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace OF_DL.Enumerations;
|
||||
|
||||
public enum Theme
|
||||
|
||||
@ -90,7 +90,7 @@ public class Config : IFileNameFormatConfig
|
||||
public LoggingLevel LoggingLevel { get; set; } = LoggingLevel.Error;
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public Theme Theme { get; set; } = Theme.light;
|
||||
public Theme Theme { get; set; } = Theme.dark;
|
||||
|
||||
[ToggleableConfig] public bool HideMissingCdmKeysWarning { get; set; }
|
||||
|
||||
|
||||
@ -237,7 +237,7 @@ public class ConfigService(ILoggingService loggingService) : IConfigService
|
||||
DownloadLimitInMbPerSec = hoconConfig.GetInt("Performance.DownloadLimitInMbPerSec"),
|
||||
|
||||
// Appearance Settings
|
||||
Theme = ParseTheme(hoconConfig.GetString("Appearance.Theme", "light")),
|
||||
Theme = ParseTheme(hoconConfig.GetString("Appearance.Theme", "dark")),
|
||||
HideMissingCdmKeysWarning =
|
||||
bool.TryParse(hoconConfig.GetString("Appearance.HideMissingCdmKeysWarning", "false"),
|
||||
out bool hideMissingCdmKeysWarning) && hideMissingCdmKeysWarning,
|
||||
@ -502,25 +502,12 @@ public class ConfigService(ILoggingService loggingService) : IConfigService
|
||||
return configChanged;
|
||||
}
|
||||
|
||||
private VideoResolution ParseVideoResolution(string value)
|
||||
{
|
||||
if (value.Equals("source", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return VideoResolution.source;
|
||||
}
|
||||
private VideoResolution ParseVideoResolution(string value) =>
|
||||
value.Equals("source", StringComparison.OrdinalIgnoreCase)
|
||||
? VideoResolution.source
|
||||
: Enum.Parse<VideoResolution>("_" + value, true);
|
||||
|
||||
return Enum.Parse<VideoResolution>("_" + value, true);
|
||||
}
|
||||
|
||||
private static Theme ParseTheme(string value)
|
||||
{
|
||||
if (Enum.TryParse(value, true, out Theme theme))
|
||||
{
|
||||
return theme;
|
||||
}
|
||||
|
||||
return Theme.light;
|
||||
}
|
||||
private static Theme ParseTheme(string value) => Enum.TryParse(value, true, out Theme theme) ? theme : Theme.dark;
|
||||
|
||||
private static double ParseDrmVideoDurationMatchThreshold(string value) =>
|
||||
!double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out double parsed)
|
||||
|
||||
@ -23,7 +23,7 @@ public class ConfigServiceTests
|
||||
Assert.Equal(service.CurrentConfig.LoggingLevel, loggingService.LastLevel);
|
||||
Assert.Equal("", service.CurrentConfig.FFprobePath);
|
||||
Assert.Equal(0.98, service.CurrentConfig.DrmVideoDurationMatchThreshold, 3);
|
||||
Assert.Equal(Theme.light, service.CurrentConfig.Theme);
|
||||
Assert.Equal(Theme.dark, service.CurrentConfig.Theme);
|
||||
Assert.False(service.CurrentConfig.HideMissingCdmKeysWarning);
|
||||
}
|
||||
|
||||
@ -142,5 +142,4 @@ public class ConfigServiceTests
|
||||
Assert.Equal("/downloads", service.CurrentConfig.DownloadPath);
|
||||
Assert.Equal(LoggingLevel.Warning, loggingService.LastLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -597,7 +597,7 @@ Description: Posts and messages that contain #ad or free trial links will be ign
|
||||
|
||||
Type: `string`
|
||||
|
||||
Default: `"light"`
|
||||
Default: `"dark"`
|
||||
|
||||
Allowed values: `"light"`, `"dark"`
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user