Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/nuget/MSTest.TestAdapter-3.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-edmondson authored Aug 23, 2024
2 parents 1163166 + 169457c commit d6d67ed
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
<ProjectReference Include="..\$(SolutionName)\$(SolutionName).csproj" />
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
</ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions ImGuiStyler/Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ public static ImColor MultiplySaturation(this ImColor color, float amount)
return FromHSLA(hsla);
}

public static ImColor OffsetHue(this ImColor color, float amount)
{
var hsla = color.ToHSLA();
hsla.X = (1f + (hsla.X + amount)) % 1f;
return FromHSLA(hsla);
}

public static ImColor LightenBy(this ImColor color, float amount)
{
var hsla = color.ToHSLA();
Expand Down
27 changes: 19 additions & 8 deletions ImGuiStyler/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ public static class Theme
{
private static float NormalLuminanceMult { get; set; } = 0.4f;
private static float NormalSaturationMult { get; set; } = 0.5f;
private static float AccentLuminanceMult { get; set; } = 0.7f;
private static float AccentSaturationMult { get; set; } = 0.8f;
private static float AccentHoveredLuminanceMult { get; set; } = 1.0f;
private static float AccentHoveredSaturationMult { get; set; } = 0.9f;
private static float AccentHueOffset { get; set; } = 0.5f;
private static float HeaderLuminanceMult { get; set; } = 0.5f;
private static float HeaderSaturationMult { get; set; } = 0.6f;
private static float ActiveLuminanceMult { get; set; } = .6f;
Expand All @@ -22,6 +27,8 @@ public static class Theme

public static ImColor GetStateColor(ImColor baseColor, bool enabled) => enabled ? baseColor : baseColor.MultiplySaturation(DisabledSaturationMult);
public static ImColor GetNormalColor(ImColor stateColor) => stateColor.MultiplyLuminance(NormalLuminanceMult).MultiplySaturation(NormalSaturationMult);
public static ImColor GetAccentColor(ImColor stateColor) => stateColor.MultiplyLuminance(AccentLuminanceMult).MultiplySaturation(AccentSaturationMult).OffsetHue(AccentHueOffset).WithAlpha(1);
public static ImColor GetAccentHoveredColor(ImColor stateColor) => stateColor.MultiplyLuminance(AccentHoveredLuminanceMult).MultiplySaturation(AccentHoveredSaturationMult).OffsetHue(AccentHueOffset).WithAlpha(1);
public static ImColor GetHeaderColor(ImColor stateColor) => stateColor.MultiplyLuminance(HeaderLuminanceMult).MultiplySaturation(HeaderSaturationMult);
public static ImColor GetActiveColor(ImColor stateColor) => stateColor.MultiplyLuminance(ActiveLuminanceMult).MultiplySaturation(ActiveSaturationMult);
public static ImColor GetHoveredColor(ImColor stateColor) => stateColor.MultiplyLuminance(HoverLuminanceMult).MultiplySaturation(HoverSaturationMult);
Expand Down Expand Up @@ -62,6 +69,8 @@ public static class Palette
public static void Apply(ImColor baseColor)
{
var normalColor = GetNormalColor(baseColor);
var accentColor = GetAccentColor(baseColor);
var accentHoveredColor = GetAccentHoveredColor(baseColor);
var headerColor = GetHeaderColor(baseColor);
var hoveredColor = GetHoveredColor(baseColor);
var activeColor = GetActiveColor(baseColor);
Expand Down Expand Up @@ -101,10 +110,10 @@ public static void Apply(ImColor baseColor)
colors[(int)ImGuiCol.ResizeGrip] = normalColor.Value;
colors[(int)ImGuiCol.ResizeGripActive] = activeColor.Value;
colors[(int)ImGuiCol.ResizeGripHovered] = hoveredColor.Value;
colors[(int)ImGuiCol.PlotLines] = normalColor.Value;
colors[(int)ImGuiCol.PlotLinesHovered] = hoveredColor.Value;
colors[(int)ImGuiCol.PlotHistogram] = normalColor.Value;
colors[(int)ImGuiCol.PlotHistogramHovered] = hoveredColor.Value;
colors[(int)ImGuiCol.PlotLines] = accentColor.Value;
colors[(int)ImGuiCol.PlotLinesHovered] = accentHoveredColor.Value;
colors[(int)ImGuiCol.PlotHistogram] = accentColor.Value;
colors[(int)ImGuiCol.PlotHistogramHovered] = accentHoveredColor.Value;
colors[(int)ImGuiCol.ScrollbarGrab] = normalColor.WithSaturation(0).Value;
colors[(int)ImGuiCol.ScrollbarGrabActive] = activeColor.WithSaturation(0).Value;
colors[(int)ImGuiCol.ScrollbarGrabHovered] = hoveredColor.WithSaturation(0).Value;
Expand All @@ -119,6 +128,8 @@ public ScopedThemeColor(ImColor baseColor, bool enabled)
{
var stateColor = GetStateColor(baseColor, enabled);
var normalColor = GetNormalColor(stateColor);
var accentColor = GetAccentColor(baseColor);
var accentHoveredColor = GetAccentHoveredColor(baseColor);
var headerColor = GetHeaderColor(stateColor);
var hoveredColor = GetHoveredColor(stateColor);
var activeColor = GetActiveColor(stateColor);
Expand Down Expand Up @@ -158,10 +169,10 @@ public ScopedThemeColor(ImColor baseColor, bool enabled)
PushStyleAndCount(ImGuiCol.ResizeGrip, normalColor, ref numStyles);
PushStyleAndCount(ImGuiCol.ResizeGripActive, activeColor, ref numStyles);
PushStyleAndCount(ImGuiCol.ResizeGripHovered, hoveredColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotLines, normalColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotLinesHovered, hoveredColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotHistogram, normalColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotHistogramHovered, hoveredColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotLines, accentColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotLinesHovered, accentHoveredColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotHistogram, accentColor, ref numStyles);
PushStyleAndCount(ImGuiCol.PlotHistogramHovered, accentHoveredColor, ref numStyles);
PushStyleAndCount(ImGuiCol.ScrollbarGrab, normalColor, ref numStyles);
PushStyleAndCount(ImGuiCol.ScrollbarGrabActive, activeColor, ref numStyles);
PushStyleAndCount(ImGuiCol.ScrollbarGrabHovered, hoveredColor, ref numStyles);
Expand Down
1 change: 1 addition & 0 deletions ImGuiStylerDemo/ImGuiStylerDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private void OnTick(float dt)
ImGui.InputText("InputText", ref valueString, 128);
float valueFloat = 0.0f;
ImGui.SliderFloat("SliderFloat", ref valueFloat, 0.0f, 1.0f);
ImGui.ProgressBar(0.95f, new(300, 0));
ImGui.Text("Text");
ImGui.TextColored(new System.Numerics.Vector4(1.0f, 0.0f, 0.0f, 1.0f), "TextColored");
ImGui.TextDisabled("TextDisabled");
Expand Down
2 changes: 1 addition & 1 deletion ImGuiStylerDemo/ImGuiStylerDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ktsu.io.ImGuiApp" Version="1.0.0-alpha.15" />
<PackageReference Include="ktsu.io.ImGuiApp" Version="1.0.0-alpha.16" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0-alpha.6
1.0.0-alpha.8

0 comments on commit d6d67ed

Please sign in to comment.