diff --git a/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs b/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs index e340172d8..8dcb1bb95 100644 --- a/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; +using System.Reflection; using Dalamud.Interface.Colors; using Dalamud.Interface.Windowing; @@ -46,9 +47,10 @@ namespace Dalamud.Interface.Internal.Windows ImGui.Separator(); - foreach (var (name, color) in this.colors) + foreach (var property in typeof(ImGuiColors).GetProperties(BindingFlags.Public | BindingFlags.Static)) { - ImGui.TextColored(color, name); + var color = (Vector4)property.GetValue(null); + ImGui.TextColored(color, property.Name); } } } diff --git a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs index 1d3757148..ce284492e 100644 --- a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs +++ b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Numerics; +using System.Reflection; using CheapLoc; using Dalamud.Configuration.Internal; @@ -76,6 +77,9 @@ namespace Dalamud.Interface.Internal.Windows.StyleEditor var config = Service.Get(); var renameModalTitle = Loc.Localize("RenameStyleModalTitle", "Rename Style"); + var workStyle = config.SavedStyles[this.currentSel]; + workStyle.BuiltInColors ??= StyleModel.DalamudStandard.BuiltInColors; + var appliedThisFrame = false; var styleAry = config.SavedStyles.Select(x => x.Name).ToArray(); @@ -290,6 +294,25 @@ namespace Dalamud.Interface.Internal.Windows.StyleEditor ImGui.PopID(); } + ImGui.Separator(); + + foreach (var property in typeof(StyleModel.DalamudColors).GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + ImGui.PushID(property.Name); + + var color = (Vector4)property.GetValue(workStyle.BuiltInColors); + if (ImGui.ColorEdit4("##color", ref color, ImGuiColorEditFlags.AlphaBar | this.alphaFlags)) + { + property.SetValue(workStyle.BuiltInColors, color); + workStyle.BuiltInColors?.Apply(); + } + + ImGui.SameLine(0.0f, style.ItemInnerSpacing.X); + ImGui.TextUnformatted(property.Name); + + ImGui.PopID(); + } + ImGui.EndChild(); ImGui.EndTabItem(); diff --git a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs index 5288ef4a1..7fa7a5b4f 100644 --- a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs +++ b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleModel.cs @@ -469,19 +469,7 @@ namespace Dalamud.Interface.Internal.Windows.StyleEditor style.Colors[(int)imGuiCol] = this.Colors[imGuiCol.ToString()]; } - if (this.BuiltInColors != null) - { - ImGuiColors.DalamudRed = this.BuiltInColors.DalamudRed; - ImGuiColors.DalamudGrey = this.BuiltInColors.DalamudGrey; - ImGuiColors.DalamudGrey2 = this.BuiltInColors.DalamudGrey2; - ImGuiColors.DalamudGrey3 = this.BuiltInColors.DalamudGrey3; - ImGuiColors.DalamudWhite = this.BuiltInColors.DalamudWhite; - ImGuiColors.DalamudWhite2 = this.BuiltInColors.DalamudWhite2; - ImGuiColors.DalamudOrange = this.BuiltInColors.DalamudOrange; - ImGuiColors.TankBlue = this.BuiltInColors.TankBlue; - ImGuiColors.HealerGreen = this.BuiltInColors.HealerGreen; - ImGuiColors.DPSRed = this.BuiltInColors.DPSRed; - } + this.BuiltInColors?.Apply(); } #pragma warning disable SA1600 @@ -517,6 +505,20 @@ namespace Dalamud.Interface.Internal.Windows.StyleEditor [JsonProperty("j")] public Vector4 DPSRed { get; set; } + + public void Apply() + { + ImGuiColors.DalamudRed = this.DalamudRed; + ImGuiColors.DalamudGrey = this.DalamudGrey; + ImGuiColors.DalamudGrey2 = this.DalamudGrey2; + ImGuiColors.DalamudGrey3 = this.DalamudGrey3; + ImGuiColors.DalamudWhite = this.DalamudWhite; + ImGuiColors.DalamudWhite2 = this.DalamudWhite2; + ImGuiColors.DalamudOrange = this.DalamudOrange; + ImGuiColors.TankBlue = this.TankBlue; + ImGuiColors.HealerGreen = this.HealerGreen; + ImGuiColors.DPSRed = this.DPSRed; + } } #pragma warning restore SA1600