mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 05:04:15 +01:00
feat: allow styling of Dalamud colors
This commit is contained in:
parent
4c4c8818a7
commit
a9a7ac85c9
3 changed files with 42 additions and 15 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<DalamudConfiguration>.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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue