mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 20:24:17 +01:00
Improve color handling.
This commit is contained in:
parent
27c41cac49
commit
909966d411
4 changed files with 19 additions and 5 deletions
|
|
@ -29,6 +29,8 @@ public enum ColorId
|
||||||
|
|
||||||
public static class Colors
|
public static class Colors
|
||||||
{
|
{
|
||||||
|
public const uint SelectedRed = 0xFF2020D0;
|
||||||
|
|
||||||
public static (uint DefaultColor, string Name, string Description) Data(this ColorId color)
|
public static (uint DefaultColor, string Name, string Description) Data(this ColorId color)
|
||||||
=> color switch
|
=> color switch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Glamourer.Customization;
|
using Glamourer.Customization;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using OtterGui;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
|
using Penumbra.GameData;
|
||||||
|
|
||||||
namespace Glamourer.Gui.Customization;
|
namespace Glamourer.Gui.Customization;
|
||||||
|
|
||||||
|
|
@ -50,10 +52,10 @@ public partial class CustomizationDrawer
|
||||||
ImGui.TextUnformatted(custom.Color == 0 ? $"{_currentOption} (NPC)" : _currentOption);
|
ImGui.TextUnformatted(custom.Color == 0 ? $"{_currentOption} (NPC)" : _currentOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawColorPickerPopup();
|
DrawColorPickerPopup(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawColorPickerPopup()
|
private void DrawColorPickerPopup(int current)
|
||||||
{
|
{
|
||||||
using var popup = ImRaii.Popup(ColorPickerPopupName, ImGuiWindowFlags.AlwaysAutoResize);
|
using var popup = ImRaii.Popup(ColorPickerPopupName, ImGuiWindowFlags.AlwaysAutoResize);
|
||||||
if (!popup)
|
if (!popup)
|
||||||
|
|
@ -70,6 +72,13 @@ public partial class CustomizationDrawer
|
||||||
ImGui.CloseCurrentPopup();
|
ImGui.CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i == current)
|
||||||
|
{
|
||||||
|
var size = ImGui.GetItemRectSize();
|
||||||
|
ImGui.GetWindowDrawList()
|
||||||
|
.AddCircleFilled(ImGui.GetItemRectMin() + size / 2, size.X / 4, ImGuiUtil.ContrastColorBW(custom.Color));
|
||||||
|
}
|
||||||
|
|
||||||
if (i % 8 != 7)
|
if (i % 8 != 7)
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Dalamud.Interface.Utility;
|
||||||
using Glamourer.Customization;
|
using Glamourer.Customization;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
|
|
@ -52,10 +53,10 @@ public partial class CustomizationDrawer
|
||||||
ImGui.TextUnformatted(label);
|
ImGui.TextUnformatted(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawIconPickerPopup();
|
DrawIconPickerPopup(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawIconPickerPopup()
|
private void DrawIconPickerPopup(int current)
|
||||||
{
|
{
|
||||||
using var popup = ImRaii.Popup(IconSelectorPopup, ImGuiWindowFlags.AlwaysAutoResize);
|
using var popup = ImRaii.Popup(IconSelectorPopup, ImGuiWindowFlags.AlwaysAutoResize);
|
||||||
if (!popup)
|
if (!popup)
|
||||||
|
|
@ -69,6 +70,8 @@ public partial class CustomizationDrawer
|
||||||
var icon = _service.AwaitedService.GetIcon(custom.IconId);
|
var icon = _service.AwaitedService.GetIcon(custom.IconId);
|
||||||
using (var _ = ImRaii.Group())
|
using (var _ = ImRaii.Group())
|
||||||
{
|
{
|
||||||
|
using var frameColor = ImRaii.PushColor(ImGuiCol.Button, Colors.SelectedRed, current == i);
|
||||||
|
|
||||||
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
|
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
|
||||||
{
|
{
|
||||||
UpdateValue(custom.Value);
|
UpdateValue(custom.Value);
|
||||||
|
|
|
||||||
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
||||||
Subproject commit 62dedf1fe7c9ee6fd7a0ee342c59f8e976468feb
|
Subproject commit a4f9b285c82f84ff0841695c0787dbba93afc59b
|
||||||
Loading…
Add table
Add a link
Reference in a new issue