Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Fix inaccurate colors in palette editor (Thanks Ny)
Browse files Browse the repository at this point in the history
Co-Authored-By: Exter-N <[email protected]>
  • Loading branch information
chirpxiv and Exter-N committed Apr 16, 2023
1 parent 99b34d0 commit 04e2536
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions PalettePlus/Interface/Components/PaletteEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
using System.Reflection;
using System.Collections.Generic;

using Dalamud.Logging;

using ImGuiNET;

using PalettePlus.Extensions;
using PalettePlus.Services;
using PalettePlus.Palettes;
using PalettePlus.Palettes.Attributes;
Expand Down Expand Up @@ -121,18 +124,21 @@ private static bool DrawField(Palette defaults, ref Palette palette, ref ParamCo
ImGui.SameLine();

if (data is Vector4 vec4) {
vec4 = vec4.RgbSqrt();

var alpha = field.Attributes.Any(attr => attr is ShowAlpha);
if (alpha) {
if (ImGui.ColorEdit4(label, ref vec4))
newVal = vec4;
newVal = vec4.RgbPow2();
} else {
var vec3 = new Vector3(vec4.X, vec4.Y, vec4.Z);
if (ImGui.ColorEdit3(label, ref vec3))
newVal = new Vector4(vec3, vec4.W);
newVal = new Vector4(vec3.RgbPow2(), vec4.W);
}
} else if (data is Vector3 vec3) {
vec3 = vec3.RgbSqrt();
if (ImGui.ColorEdit3(label, ref vec3))
newVal = vec3;
newVal = vec3.RgbPow2();
} else if (data is float flt) {
var slider = (Slider?)field.Attributes.FirstOrDefault(attr => attr is Slider);

Expand Down

0 comments on commit 04e2536

Please sign in to comment.