mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-29 20:03:41 +01:00
feat: add color picker with palette component
This commit is contained in:
parent
7d2a900832
commit
01d84f0e65
3 changed files with 98 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
|
||||
|
|
@ -57,6 +58,23 @@ namespace Dalamud.Interface
|
|||
string name, Vector2 position, ImGuiCond condition = ImGuiCond.None)
|
||||
=> ImGui.SetWindowPos(position + MainViewport.Pos, condition);
|
||||
|
||||
/// <summary>
|
||||
/// Creates default color palette for use with color pickers.
|
||||
/// </summary>
|
||||
/// <param name="swatchCount">The total number of swatches to use.</param>
|
||||
/// <returns>Default color palette.</returns>
|
||||
public static List<Vector4> DefaultColorPalette(int swatchCount = 32)
|
||||
{
|
||||
var colorPalette = new List<Vector4>();
|
||||
for (var i = 0; i < swatchCount; i++)
|
||||
{
|
||||
ImGui.ColorConvertHSVtoRGB(i / 31.0f, 0.7f, 0.8f, out var r, out var g, out var b);
|
||||
colorPalette.Add(new Vector4(r, g, b, 1.0f));
|
||||
}
|
||||
|
||||
return colorPalette;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get data needed for each new frame.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue