Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DeathlyBower959 committed Jan 1, 2024
1 parent eb82da3 commit 0b762f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions JiayiLauncher/Appearance/LocalTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public static LocalTheme[] GetAllThemes()
{
var localThemes = new List<LocalTheme>();

var path = Path.Combine(_themeRoot, ".local");
Directory.CreateDirectory(path); // Ensure directory exists
var directories = Directory.GetDirectories(Path.Combine(_themeRoot, ".local"));
foreach (var d in directories)
{
Expand Down
18 changes: 9 additions & 9 deletions JiayiLauncher/Settings/JiayiSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public JiayiSettings(ThemeState themeState)
_themeState = themeState;
}

private string TemporaryFromHex(Color c)
private string HexToColor(Color c)
{
return "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
}
Expand Down Expand Up @@ -94,47 +94,47 @@ private string TemporaryFromHex(Color c)
public Color PrimaryBackgroundColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--background-primary")?.Value ?? "#0f0f0f");
set => _themeState.UpdateTheme("--background-primary", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--background-primary", HexToColor(value));
}

[JsonIgnore]
[Setting("Secondary background color", "Appearance", "The secondary background color of the launcher.")]
public Color SecondaryBackgroundColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--background-secondary")?.Value ?? "#1e1e1e");
set => _themeState.UpdateTheme("--background-secondary", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--background-secondary", HexToColor(value));
}

[JsonIgnore]
[Setting("Accent color", "Appearance", "The accent color of the launcher.")]
public Color AccentColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--accent")?.Value ?? "#dc0000");
set => _themeState.UpdateTheme("--accent", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--accent", HexToColor(value));
}

[JsonIgnore]
[Setting("Text color", "Appearance", "The color of text seen throughout the launcher.")]
public Color TextColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--text-primary")?.Value ?? "#ffffff");
set => _themeState.UpdateTheme("--text-primary", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--text-primary", HexToColor(value));
}

[JsonIgnore]
[Setting("Text color (on accent)", "Appearance", "The color of text on top of the accent color.")]
public Color AccentTextColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--text-accent")?.Value ?? "#ffffff");
set => _themeState.UpdateTheme("--text-accent", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--text-accent", HexToColor(value));
}

[JsonIgnore]
[Setting("Gray text color", "Appearance", "A gray version of the text color.")]
public Color GrayTextColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--text-grayed")?.Value ?? "#7e7e7e");
set => _themeState.UpdateTheme("--text-grayed", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--text-grayed", HexToColor(value));
}

[JsonIgnore]
Expand Down Expand Up @@ -208,15 +208,15 @@ public int[] Rounding
public Color BorderColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--border-primary")?.Value ?? "#000000");
set => _themeState.UpdateTheme("--border-primary", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--border-primary", HexToColor(value));
}

[JsonIgnore]
[Setting("Border color (on accent)", "Appearance", "The color of the border around the accent color.")]
public Color AccentBorderColor
{
get => ColorTranslator.FromHtml(_themeState.ThemeCSS.GetProperty(":root", "--border-accent")?.Value ?? "#000000");
set => _themeState.UpdateTheme("--border-accent", TemporaryFromHex(value));
set => _themeState.UpdateTheme("--border-accent", HexToColor(value));
}

[JsonIgnore]
Expand Down

0 comments on commit 0b762f9

Please sign in to comment.