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;
|
namespace OF_DL.Enumerations;
|
||||||
|
|
||||||
public enum Theme
|
public enum Theme
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public class Config : IFileNameFormatConfig
|
|||||||
public LoggingLevel LoggingLevel { get; set; } = LoggingLevel.Error;
|
public LoggingLevel LoggingLevel { get; set; } = LoggingLevel.Error;
|
||||||
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public Theme Theme { get; set; } = Theme.light;
|
public Theme Theme { get; set; } = Theme.dark;
|
||||||
|
|
||||||
[ToggleableConfig] public bool HideMissingCdmKeysWarning { get; set; }
|
[ToggleableConfig] public bool HideMissingCdmKeysWarning { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -237,7 +237,7 @@ public class ConfigService(ILoggingService loggingService) : IConfigService
|
|||||||
DownloadLimitInMbPerSec = hoconConfig.GetInt("Performance.DownloadLimitInMbPerSec"),
|
DownloadLimitInMbPerSec = hoconConfig.GetInt("Performance.DownloadLimitInMbPerSec"),
|
||||||
|
|
||||||
// Appearance Settings
|
// Appearance Settings
|
||||||
Theme = ParseTheme(hoconConfig.GetString("Appearance.Theme", "light")),
|
Theme = ParseTheme(hoconConfig.GetString("Appearance.Theme", "dark")),
|
||||||
HideMissingCdmKeysWarning =
|
HideMissingCdmKeysWarning =
|
||||||
bool.TryParse(hoconConfig.GetString("Appearance.HideMissingCdmKeysWarning", "false"),
|
bool.TryParse(hoconConfig.GetString("Appearance.HideMissingCdmKeysWarning", "false"),
|
||||||
out bool hideMissingCdmKeysWarning) && hideMissingCdmKeysWarning,
|
out bool hideMissingCdmKeysWarning) && hideMissingCdmKeysWarning,
|
||||||
@ -502,25 +502,12 @@ public class ConfigService(ILoggingService loggingService) : IConfigService
|
|||||||
return configChanged;
|
return configChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private VideoResolution ParseVideoResolution(string value)
|
private VideoResolution ParseVideoResolution(string value) =>
|
||||||
{
|
value.Equals("source", StringComparison.OrdinalIgnoreCase)
|
||||||
if (value.Equals("source", StringComparison.OrdinalIgnoreCase))
|
? VideoResolution.source
|
||||||
{
|
: Enum.Parse<VideoResolution>("_" + value, true);
|
||||||
return VideoResolution.source;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Enum.Parse<VideoResolution>("_" + value, true);
|
private static Theme ParseTheme(string value) => Enum.TryParse(value, true, out Theme theme) ? theme : Theme.dark;
|
||||||
}
|
|
||||||
|
|
||||||
private static Theme ParseTheme(string value)
|
|
||||||
{
|
|
||||||
if (Enum.TryParse(value, true, out Theme theme))
|
|
||||||
{
|
|
||||||
return theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Theme.light;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double ParseDrmVideoDurationMatchThreshold(string value) =>
|
private static double ParseDrmVideoDurationMatchThreshold(string value) =>
|
||||||
!double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out double parsed)
|
!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.LoggingLevel, loggingService.LastLevel);
|
||||||
Assert.Equal("", service.CurrentConfig.FFprobePath);
|
Assert.Equal("", service.CurrentConfig.FFprobePath);
|
||||||
Assert.Equal(0.98, service.CurrentConfig.DrmVideoDurationMatchThreshold, 3);
|
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);
|
Assert.False(service.CurrentConfig.HideMissingCdmKeysWarning);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,5 +142,4 @@ public class ConfigServiceTests
|
|||||||
Assert.Equal("/downloads", service.CurrentConfig.DownloadPath);
|
Assert.Equal("/downloads", service.CurrentConfig.DownloadPath);
|
||||||
Assert.Equal(LoggingLevel.Warning, loggingService.LastLevel);
|
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`
|
Type: `string`
|
||||||
|
|
||||||
Default: `"light"`
|
Default: `"dark"`
|
||||||
|
|
||||||
Allowed values: `"light"`, `"dark"`
|
Allowed values: `"light"`, `"dark"`
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user