mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-09-14 13:56:56 +08:00
1.1.3 -> 1.1.4 第55次更新
This commit is contained in:
parent
67079cf9e0
commit
73de1516ea
@ -71,6 +71,9 @@ internal partial class MainPres : GlobalPres
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private bool isUpstreamHostUtd = true;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool isNginxExist = File.Exists(MainConst.NginxPath);
|
private bool isNginxExist = File.Exists(MainConst.NginxPath);
|
||||||
|
|
||||||
|
4
Props/Settings.Designer.cs
generated
4
Props/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace Sheas_Cealer.Props {
|
|||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
@ -85,7 +85,7 @@ namespace Sheas_Cealer.Props {
|
|||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("Red")]
|
[global::System.Configuration.DefaultSettingValueAttribute("244, 67, 54")]
|
||||||
public global::System.Drawing.Color PrimaryColor {
|
public global::System.Drawing.Color PrimaryColor {
|
||||||
get {
|
get {
|
||||||
return ((global::System.Drawing.Color)(this["PrimaryColor"]));
|
return ((global::System.Drawing.Color)(this["PrimaryColor"]));
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<Value Profile="(Default)">-1</Value>
|
<Value Profile="(Default)">-1</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting Name="PrimaryColor" Type="System.Drawing.Color" Scope="User">
|
<Setting Name="PrimaryColor" Type="System.Drawing.Color" Scope="User">
|
||||||
<Value Profile="(Default)">Red</Value>
|
<Value Profile="(Default)">244, 67, 54</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting Name="IsLightWeight" Type="System.SByte" Scope="User">
|
<Setting Name="IsLightWeight" Type="System.SByte" Scope="User">
|
||||||
<Value Profile="(Default)">-1</Value>
|
<Value Profile="(Default)">-1</Value>
|
||||||
|
@ -15,17 +15,17 @@ internal static class ForegroundGenerator
|
|||||||
double hue = GetHue(red / 255.0, green / 255.0, blue / 255.0);
|
double hue = GetHue(red / 255.0, green / 255.0, blue / 255.0);
|
||||||
|
|
||||||
double blueContrast = Math.Min(Math.Abs(hue - 206.57), 360 - Math.Abs(hue - 206.57));
|
double blueContrast = Math.Min(Math.Abs(hue - 206.57), 360 - Math.Abs(hue - 206.57));
|
||||||
double redContrast = Math.Min(Math.Abs(hue), 360 - Math.Abs(hue));
|
double redContrast = Math.Min(Math.Abs(hue - 4.11), 360 - Math.Abs(hue - 4.11));
|
||||||
|
|
||||||
return (blackContrast >= 4 && whiteContrast >= 3 ? null :
|
return (blackContrast >= 4 && whiteContrast >= 3 ? null :
|
||||||
blackContrast >= whiteContrast ? Color.FromRgb(0, 0, 0) : Color.FromRgb(255, 255, 255),
|
blackContrast >= whiteContrast ? Colors.Black : Colors.White,
|
||||||
blueContrast >= redContrast ? (Color)ColorConverter.ConvertFromString("#2196f3") : Color.FromRgb(255, 0, 0));
|
(Color)ColorConverter.ConvertFromString(blueContrast >= redContrast ? "#2196f3" : "#f44336"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double GammaCorrect(double component) => component <= 0.03928 ? component / 12.92 : Math.Pow((component + 0.055) / 1.055, 2.4);
|
private static double GammaCorrect(double component) => component <= 0.03928 ? component / 12.92 : Math.Pow((component + 0.055) / 1.055, 2.4);
|
||||||
|
|
||||||
private static double GetHue(double redComponent, double greenComponent, double blueComponent) =>
|
private static double GetHue(double redComponent, double greenComponent, double blueComponent) =>
|
||||||
redComponent > greenComponent && redComponent > blueComponent ? 60 * ((greenComponent - blueComponent) / redComponent - Math.Min(greenComponent, blueComponent) + (greenComponent < blueComponent ? 6 : 0)) :
|
redComponent > greenComponent && redComponent > blueComponent ? 60 * ((greenComponent - blueComponent) / (redComponent - Math.Min(greenComponent, blueComponent)) + (greenComponent < blueComponent ? 6 : 0)) :
|
||||||
greenComponent > blueComponent && greenComponent > redComponent ? 60 * ((blueComponent - redComponent) / greenComponent - Math.Min(blueComponent, redComponent) + 2) :
|
greenComponent > blueComponent && greenComponent > redComponent ? 60 * ((blueComponent - redComponent) / (greenComponent - Math.Min(blueComponent, redComponent)) + 2) :
|
||||||
blueComponent > redComponent && blueComponent > greenComponent ? 60 * ((redComponent - greenComponent) / blueComponent - Math.Min(redComponent, greenComponent) + 4) : 0;
|
blueComponent > redComponent && blueComponent > greenComponent ? 60 * ((redComponent - greenComponent) / (blueComponent - Math.Min(redComponent, greenComponent)) + 4) : 0;
|
||||||
}
|
}
|
@ -84,6 +84,9 @@ public partial class MainWin : Window
|
|||||||
|
|
||||||
if (!MainPres.IsNginxRunning)
|
if (!MainPres.IsNginxRunning)
|
||||||
NginxStoppedCleaner.Clean();
|
NginxStoppedCleaner.Clean();
|
||||||
|
|
||||||
|
try { UpdateUpstreamHostButton_Click(null!, null!); }
|
||||||
|
catch { }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void MainWin_Closing(object sender, CancelEventArgs e) => Application.Current.Shutdown();
|
private void MainWin_Closing(object sender, CancelEventArgs e) => Application.Current.Shutdown();
|
||||||
@ -418,7 +421,12 @@ public partial class MainWin : Window
|
|||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
if (localUpstreamHostString == upstreamUpstreamHostString || localUpstreamHostString.ReplaceLineEndings() == upstreamUpstreamHostString.ReplaceLineEndings())
|
if (localUpstreamHostString == upstreamUpstreamHostString || localUpstreamHostString.ReplaceLineEndings() == upstreamUpstreamHostString.ReplaceLineEndings())
|
||||||
MessageBox.Show(MainConst._UpstreamHostUtdMsg);
|
if (sender == null)
|
||||||
|
MainPres.IsUpstreamHostUtd = true;
|
||||||
|
else
|
||||||
|
MessageBox.Show(MainConst._UpstreamHostUtdMsg);
|
||||||
|
else if (sender == null)
|
||||||
|
MainPres.IsUpstreamHostUtd = false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBoxResult overrideOptionResult = MessageBox.Show(MainConst._OverrideUpstreamHostPrompt, string.Empty, MessageBoxButton.YesNoCancel);
|
MessageBoxResult overrideOptionResult = MessageBox.Show(MainConst._OverrideUpstreamHostPrompt, string.Empty, MessageBoxButton.YesNoCancel);
|
||||||
@ -473,9 +481,12 @@ public partial class MainWin : Window
|
|||||||
PaletteHelper paletteHelper = new();
|
PaletteHelper paletteHelper = new();
|
||||||
Theme newTheme = paletteHelper.GetTheme();
|
Theme newTheme = paletteHelper.GetTheme();
|
||||||
Color newPrimaryColor = Color.FromRgb((byte)random.Next(256), (byte)random.Next(256), (byte)random.Next(256));
|
Color newPrimaryColor = Color.FromRgb((byte)random.Next(256), (byte)random.Next(256), (byte)random.Next(256));
|
||||||
|
Color newSecondaryColor = random.Next(3) == 0 ? newPrimaryColor with { R = (byte)((newPrimaryColor.R + 109) % 256) } :
|
||||||
|
random.Next(2) == 0 ? newPrimaryColor with { G = (byte)((newPrimaryColor.G + 109) % 256) } : newPrimaryColor with { B = (byte)((newPrimaryColor.B + 109) % 256) };
|
||||||
bool isLightTheme = random.Next(2) == 0;
|
bool isLightTheme = random.Next(2) == 0;
|
||||||
|
|
||||||
newTheme.SetPrimaryColor(newPrimaryColor);
|
newTheme.SetPrimaryColor(newPrimaryColor);
|
||||||
|
newTheme.SetSecondaryColor(newSecondaryColor);
|
||||||
newTheme.SetBaseTheme(isLightTheme ? BaseTheme.Light : BaseTheme.Dark);
|
newTheme.SetBaseTheme(isLightTheme ? BaseTheme.Light : BaseTheme.Dark);
|
||||||
paletteHelper.SetTheme(newTheme);
|
paletteHelper.SetTheme(newTheme);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user