Skip to content

Commit

Permalink
Merge pull request #447 from Leo-Corporation/vNext
Browse files Browse the repository at this point in the history
Version 6.6.0.2501
  • Loading branch information
lpeyr authored Jan 3, 2025
2 parents 3a7097f + b43bee4 commit 11a92d9
Show file tree
Hide file tree
Showing 29 changed files with 1,204 additions and 1,443 deletions.
396 changes: 396 additions & 0 deletions ColorPicker.Setup/Languages/ChineseSimplified.isl

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ColorPicker.Setup/Setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "ColorPicker Max"
#define MyAppVersion "6.5.0.2408"
#define MyAppFullVersion "6.5.0.2408"
#define MyAppVersion "6.6.0.2501"
#define MyAppFullVersion "6.6.0.2501"
#define MyAppPublisher "Léo Corporation"
#define MyAppURL "https://leocorporation.dev/"
#define MyAppExeName "ColorPicker.exe"
Expand Down Expand Up @@ -40,7 +40,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
; Remove the line below if there are compilation errors
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
Name: "chinesesimplified"; MessagesFile: "Languages\ChineseSimplified.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Expand Down
1 change: 0 additions & 1 deletion ColorPicker/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ private void Application_Startup(object sender, StartupEventArgs e)
Global.PalettePage = new();
Global.GradientPage = new();
Global.AiGenPage = new();
Global.HarmoniesPage = new();
Global.HomePage = new();
Global.BookmarksPage = new();
Global.SettingsPage = new();
Expand Down
8 changes: 3 additions & 5 deletions ColorPicker/Classes/Bookmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ public BookmarkText(string font, string fore, string back)

public bool Equals(BookmarkText? obj)
{
if (obj == null || GetType() != obj.GetType())
{
return false;
}
return FontFamily == obj.FontFamily && ForegroundColor == obj.ForegroundColor && BackgroundColor == obj.BackgroundColor;
return obj == null || GetType() != obj.GetType()
? false
: FontFamily == obj.FontFamily && ForegroundColor == obj.ForegroundColor && BackgroundColor == obj.BackgroundColor;
}


Expand Down
20 changes: 5 additions & 15 deletions ColorPicker/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public static class Global
public static PalettePage? PalettePage { get; set; }
public static GradientPage? GradientPage { get; set; }
public static AiGenPage? AiGenPage { get; set; }
public static HarmoniesPage? HarmoniesPage { get; set; }
public static HomePage? HomePage { get; set; }
public static BookmarksPage? BookmarksPage { get; set; }
public static SettingsPage? SettingsPage { get; set; }
Expand Down Expand Up @@ -93,7 +92,7 @@ public static class Global
internal static string SettingsPath => $@"{FileSys.AppDataPath}\Léo Corporation\ColorPicker Max\Settings.xml";
public static string LastVersionLink => "https://raw.githubusercontent.com/Leo-Corporation/LeoCorp-Docs/master/Liens/Update%20System/ColorPicker/5.0/Version.txt";

public static string Version => "6.5.0.2408";
public static string Version => "6.6.0.2501";

public static string HiSentence
{
Expand Down Expand Up @@ -134,7 +133,6 @@ public static string HiSentence
{ AppPages.ColorPalette, "\uF2F6" },
{ AppPages.ColorGradient, "\uFD3F" },
{ AppPages.AIGeneration, "\uF4E5" },
{ AppPages.Harmonies, "\uFD0F" },
{ AppPages.ImageExtractor, "\uF49B" },
{ AppPages.ContrastGrid, "\uF467" }
};
Expand All @@ -150,7 +148,6 @@ public static string HiSentence
{ AppPages.ColorPalette, Properties.Resources.Palette },
{ AppPages.ColorGradient, Properties.Resources.Gradient },
{ AppPages.AIGeneration, Properties.Resources.AIGeneration },
{ AppPages.Harmonies, Properties.Resources.Harmonies},
{ AppPages.ImageExtractor, Properties.Resources.ImageExtractor},
{ AppPages.ContrastGrid, Properties.Resources.ContrastGrid},
};
Expand Down Expand Up @@ -196,9 +193,7 @@ public static (string, int) GetContrast(int[] rgb1, int[] rgb2)

var result = Math.Round((brightest + 0.05) / (darkest + 0.05), 4);

int gridRow;
if (result > 7) gridRow = 0;
else gridRow = 0;
int gridRow = result > 7 ? 0 : 0;
if (result <= 3) gridRow = 3;
if (result >= 3 && result <= 4.5) gridRow = 2;
if (result >= 4.5 && result <= 7) gridRow = 1;
Expand Down Expand Up @@ -265,7 +260,6 @@ public static AppPages PageInfoToAppPages(PageInfo pageInfo)
"Palette" => AppPages.ColorPalette,
"Gradient" => AppPages.ColorGradient,
"AIGeneration" => AppPages.AIGeneration,
"Harmonies" => AppPages.Harmonies,
"ImageExtractor" => AppPages.ImageExtractor,
"ContrastGrid" => AppPages.ContrastGrid,
_ => AppPages.Selector
Expand Down Expand Up @@ -300,10 +294,10 @@ public static void ChangeTheme(bool reload = false)
App.Current.Resources.MergedDictionaries.Add(resourceDictionary); // Add the dictionary

if (!reload) return;
SettingsPage.LoadUpdateSection();
BookmarksPage.CheckButton(BookmarksPage.CheckedButton);
ConverterPage.CheckButton(ConverterPage.SelectedColorBtn);
ChromaticWheelPage.CheckButton(ChromaticWheelPage.CheckedButton);
HarmoniesPage.CheckButton(HarmoniesPage.SelectedColorBtn);
PalettePage.CheckButton(PalettePage.SelectedColorBtn);
ContrastPage.CheckButton(ContrastPage.RgbBtn);
ContrastPage.InitGrid(ContrastPage.contrastLimit);
Expand Down Expand Up @@ -532,10 +526,7 @@ public static void ColorToHSL(Color color, out float h, out float s, out float l
float delta = max - min;
if (max == r)
h = (g - b) / delta + (g < b ? 6 : 0);
else if (max == g)
h = (b - r) / delta + 2;
else
h = (r - g) / delta + 4;
else h = max == g ? (b - r) / delta + 2 : (r - g) / delta + 4;
h /= 6f;
}

Expand Down Expand Up @@ -570,7 +561,6 @@ private static float HueToRGB(float p, float q, float t)
if (t > 1) t -= 1;
if (t < 1.0 / 6.0) return p + (q - p) * 6 * t;
if (t < 1.0 / 2.0) return q;
if (t < 2.0 / 3.0) return p + (q - p) * (2.0f / 3.0f - t) * 6;
return p;
return t < 2.0 / 3.0 ? p + (q - p) * (2.0f / 3.0f - t) * 6 : p;
}
}
4 changes: 2 additions & 2 deletions ColorPicker/ColorPicker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<Title>ColorPicker</Title>
<Description>Maximize your creativity.</Description>
<RepositoryUrl>https://github.com/Leo-Corporation/ColorPicker</RepositoryUrl>
<Version>6.5.0.2408</Version>
<Version>6.6.0.2501</Version>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
<ApplicationIcon>CPM.ico</ApplicationIcon>
Expand Down Expand Up @@ -48,7 +48,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Betalgo.OpenAI" Version="8.6.1" />
<PackageReference Include="Betalgo.OpenAI" Version="8.7.2" />
<PackageReference Include="ColorHelper" Version="1.8.1" />
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
<PackageReference Include="PeyrSharp.Core" Version="2.1.0.2312" />
Expand Down
1 change: 0 additions & 1 deletion ColorPicker/Enums/AppPages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public enum AppPages
ColorPalette,
ColorGradient,
AIGeneration,
Harmonies,
ImageExtractor,
ContrastGrid
}
14 changes: 0 additions & 14 deletions ColorPicker/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -739,20 +739,6 @@
Foreground="{DynamicResource AccentColor}"
GroupName="NavBar"
Style="{DynamicResource NavBarToolButton}" />
<RadioButton
x:Name="HarmoniesPageBtn"
Margin="10 0 0 0"
Padding="5 2 2 2"
HorizontalContentAlignment="Left"
Background="Transparent"
BorderThickness="0"
Click="HarmoniesPageBtn_Click"
Content="{x:Static lang:Resources.Harmonies}"
FontSize="10"
FontWeight="ExtraBold"
Foreground="{DynamicResource AccentColor}"
GroupName="NavBar"
Style="{DynamicResource NavBarToolButton}" />
<RadioButton
x:Name="GradientPageBtn"
Margin="10 0 0 0"
Expand Down
28 changes: 2 additions & 26 deletions ColorPicker/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ public MainWindow()
GC.Collect();
}

DoubleAnimation expandAnimation = new()
readonly DoubleAnimation expandAnimation = new()
{
From = 0,
To = 180,
Duration = new Duration(TimeSpan.FromSeconds(0.2)),
};

DoubleAnimation collapseAnimation = new()
readonly DoubleAnimation collapseAnimation = new()
{
From = 180,
To = 0,
Expand Down Expand Up @@ -133,10 +133,6 @@ private void InitUI()
Global.SynethiaConfig.PagesInfo[6].EnterUnixTime = Sys.UnixTime;
AiCreationPageBtn.IsChecked = true;
break;
case AppPages.Harmonies:
Global.SynethiaConfig.PagesInfo[7].EnterUnixTime = Sys.UnixTime;
HarmoniesPageBtn.IsChecked = true;
break;
case AppPages.ImageExtractor:
Global.SynethiaConfig.PagesInfo[8].EnterUnixTime = Sys.UnixTime;
ImageExtractorPageBtn.IsChecked = true;
Expand All @@ -159,7 +155,6 @@ private void InitUI()
AppPages.ColorPalette => Global.PalettePage,
AppPages.ColorGradient => Global.GradientPage,
AppPages.AIGeneration => Global.AiGenPage,
AppPages.Harmonies => Global.HarmoniesPage,
AppPages.ImageExtractor => Global.ImageExtractorPage,
AppPages.ContrastGrid => Global.ContrastPage,
_ => Global.HomePage
Expand Down Expand Up @@ -213,12 +208,6 @@ private void PageCard_OnCardClick(object? sender, PageEventArgs e)
PageDisplayer.Navigate(Global.AiGenPage);
Global.SynethiaConfig.PagesInfo[6].EnterUnixTime = Sys.UnixTime;
break;
case AppPages.Harmonies:
HarmoniesPageBtn.IsChecked = true;

PageDisplayer.Navigate(Global.HarmoniesPage);
Global.SynethiaConfig.PagesInfo[7].EnterUnixTime = Sys.UnixTime;
break;
case AppPages.ImageExtractor:
ImageExtractorPageBtn.IsChecked = true;

Expand Down Expand Up @@ -465,10 +454,6 @@ private void LeavePage()
Global.SynethiaConfig.PagesInfo[6].LeaveUnixTime = Sys.UnixTime;
Global.SynethiaConfig.PagesInfo[6].TotalTimeSpent += Global.SynethiaConfig.PagesInfo[6].LeaveUnixTime - Global.SynethiaConfig.PagesInfo[6].EnterUnixTime;
break;
case HarmoniesPage:
Global.SynethiaConfig.PagesInfo[7].LeaveUnixTime = Sys.UnixTime;
Global.SynethiaConfig.PagesInfo[7].TotalTimeSpent += Global.SynethiaConfig.PagesInfo[7].LeaveUnixTime - Global.SynethiaConfig.PagesInfo[7].EnterUnixTime;
break;
case ImageExtractorPage:
Global.SynethiaConfig.PagesInfo[8].LeaveUnixTime = Sys.UnixTime;
Global.SynethiaConfig.PagesInfo[8].TotalTimeSpent += Global.SynethiaConfig.PagesInfo[8].LeaveUnixTime - Global.SynethiaConfig.PagesInfo[8].EnterUnixTime;
Expand All @@ -491,15 +476,6 @@ private void AiCreationPageBtn_Click(object sender, RoutedEventArgs e)
Global.SynethiaConfig.PagesInfo[6].EnterUnixTime = Sys.UnixTime;
}

private void HarmoniesPageBtn_Click(object sender, RoutedEventArgs e)
{
LeavePage();
HarmoniesPageBtn.IsChecked = true;

PageDisplayer.Navigate(Global.HarmoniesPage);
Global.SynethiaConfig.PagesInfo[7].EnterUnixTime = Sys.UnixTime;
}

private void ImageExtractorPageBtn_Click(object sender, RoutedEventArgs e)
{
LeavePage();
Expand Down
1 change: 0 additions & 1 deletion ColorPicker/Pages/AiGenPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
using OpenAI.ObjectModels.RequestModels;
using Synethia;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.Json;
Expand Down
1 change: 0 additions & 1 deletion ColorPicker/Pages/BookmarksPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ internal void InitUI()

Global.SelectorPage.LoadBookmarkMenu();
Global.ConverterPage.LoadBookmarkMenu();
Global.HarmoniesPage.LoadBookmarkMenu();
}

internal void ColorsBtn_Click(object sender, RoutedEventArgs e)
Expand Down
5 changes: 3 additions & 2 deletions ColorPicker/Pages/ContrastPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ private RGB ConvertToRgb()
else if (SelectedColorBtn == YuvBtn) return ColorHelper.ColorConverter.YuvToRgb(new(double.Parse(Txt1.Text),
double.Parse(Txt2.Text),
double.Parse(Txt3.Text)));
else if (SelectedColorBtn == DecBtn) return new DEC(int.Parse(Txt5.Text)).ToRgb();
else return ColorHelper.ColorConverter.YiqToRgb(new(double.Parse(Txt1.Text),
else return SelectedColorBtn == DecBtn
? new DEC(int.Parse(Txt5.Text)).ToRgb()
: ColorHelper.ColorConverter.YiqToRgb(new(double.Parse(Txt1.Text),
double.Parse(Txt2.Text),
double.Parse(Txt3.Text)));
}
Expand Down
5 changes: 3 additions & 2 deletions ColorPicker/Pages/ConverterPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ private RGB ConvertToRgb()
else if (SelectedColorBtn == YuvBtn) return ColorHelper.ColorConverter.YuvToRgb(new(double.Parse(Txt1.Text),
double.Parse(Txt2.Text),
double.Parse(Txt3.Text)));
else if (SelectedColorBtn == DecBtn) return new DEC(int.Parse(Txt5.Text)).ToRgb();
else return ColorHelper.ColorConverter.YiqToRgb(new(double.Parse(Txt1.Text),
else return SelectedColorBtn == DecBtn
? new DEC(int.Parse(Txt5.Text)).ToRgb()
: ColorHelper.ColorConverter.YiqToRgb(new(double.Parse(Txt1.Text),
double.Parse(Txt2.Text),
double.Parse(Txt3.Text)));
}
Expand Down
5 changes: 3 additions & 2 deletions ColorPicker/Pages/GradientPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,9 @@ private ColorHelper.RGB ConvertToRgb()
else if (SelectedColorBtn == YuvBtn) return ColorHelper.ColorConverter.YuvToRgb(new(double.Parse(Txt1.Text),
double.Parse(Txt2.Text),
double.Parse(Txt3.Text)));
else if (SelectedColorBtn == DecBtn) return new DEC(int.Parse(Txt5.Text)).ToRgb();
else return ColorHelper.ColorConverter.YiqToRgb(new(double.Parse(Txt1.Text),
else return SelectedColorBtn == DecBtn
? new DEC(int.Parse(Txt5.Text)).ToRgb()
: ColorHelper.ColorConverter.YiqToRgb(new(double.Parse(Txt1.Text),
double.Parse(Txt2.Text),
double.Parse(Txt3.Text)));
}
Expand Down
Loading

0 comments on commit 11a92d9

Please sign in to comment.