table layout for color settings
This commit is contained in:
@@ -978,45 +978,66 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
var colorNames = new[]
|
var colorNames = new[]
|
||||||
{
|
{
|
||||||
("LightlessPurple", "Lightless Purple", "Primary colors"),
|
("LightlessPurple", "Lightless Purple", "Section titles and dividers"),
|
||||||
("LightlessPurpleActive", "Lightless Purple Active", "Primary colors"),
|
("LightlessPurpleActive", "Lightless Purple Active", "Active tabs and hover highlights"),
|
||||||
("LightlessPurpleDefault", "Lightless Purple Inactive", "Primary colors"),
|
("LightlessPurpleDefault", "Lightless Purple Inactive", "Inactive tabs and default dividers"),
|
||||||
("LightlessBlue", "Lightless Blue", "Secondary colors"),
|
("LightlessBlue", "Lightless Blue", "On/true toggles and 'Upload complete' status"),
|
||||||
|
|
||||||
("LightlessGreen", "Lightless Green", "Active elements"),
|
("LightlessGreen", "Lightless Green", "Join buttons and success messages"),
|
||||||
|
|
||||||
("LightlessYellow", "Lightless Yellow", "Warning colors"),
|
("LightlessYellow", "Lightless Yellow", "Warning colors"),
|
||||||
("LightlessYellow2", "Lightless Yellow 2", "Warning colors"),
|
("LightlessYellow2", "Lightless Yellow 2", "Warning colors"),
|
||||||
|
|
||||||
("PairBlue", "Pair Blue", "Pair UI elements"),
|
("PairBlue", "Pair Blue", "Syncshell headers, toggle highlights, and moderator actions"),
|
||||||
|
|
||||||
("DimRed", "Dim Red", "Error and offline")
|
("DimRed", "Dim Red", "Error and offline colors")
|
||||||
};
|
};
|
||||||
|
if (ImGui.BeginTable("##ColorTable", 3, ImGuiTableFlags.Borders | ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit))
|
||||||
foreach (var (colorKey, displayName, description) in colorNames)
|
|
||||||
{
|
{
|
||||||
var currentColor = UIColors.Get(colorKey);
|
ImGui.TableSetupColumn("Color", ImGuiTableColumnFlags.WidthStretch);
|
||||||
var colorToEdit = currentColor;
|
ImGui.TableSetupColumn("Description", ImGuiTableColumnFlags.WidthStretch);
|
||||||
|
ImGui.TableSetupColumn("Reset", ImGuiTableColumnFlags.WidthFixed, 40);
|
||||||
|
ImGui.TableHeadersRow();
|
||||||
|
|
||||||
ImGui.AlignTextToFramePadding();
|
foreach (var (colorKey, displayName, description) in colorNames)
|
||||||
|
|
||||||
if (ImGui.ColorEdit4($"##color_{colorKey}", ref colorToEdit, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.AlphaPreviewHalf))
|
|
||||||
{
|
{
|
||||||
UIColors.Set(colorKey, colorToEdit);
|
ImGui.TableNextRow();
|
||||||
}
|
|
||||||
|
// olor column
|
||||||
ImGui.SameLine();
|
ImGui.TableSetColumnIndex(0);
|
||||||
ImGui.TextUnformatted($"{displayName} - {description}");
|
var currentColor = UIColors.Get(colorKey);
|
||||||
|
var colorToEdit = currentColor;
|
||||||
if (UIColors.IsCustom(colorKey))
|
if (ImGui.ColorEdit4($"##color_{colorKey}", ref colorToEdit, ImGuiColorEditFlags.NoInputs | ImGuiColorEditFlags.AlphaPreviewHalf))
|
||||||
{
|
|
||||||
ImGui.SameLine();
|
|
||||||
if (_uiShared.IconTextButton(FontAwesomeIcon.Undo, $"Reset {colorKey}"))
|
|
||||||
{
|
{
|
||||||
UIColors.Reset(colorKey);
|
UIColors.Set(colorKey, colorToEdit);
|
||||||
|
}
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.TextUnformatted(displayName);
|
||||||
|
|
||||||
|
// description column
|
||||||
|
ImGui.TableSetColumnIndex(1);
|
||||||
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.TextUnformatted(description);
|
||||||
|
|
||||||
|
// actions column
|
||||||
|
ImGui.TableSetColumnIndex(2);
|
||||||
|
if (UIColors.IsCustom(colorKey))
|
||||||
|
{
|
||||||
|
using var resetId = ImRaii.PushId($"Reset_{colorKey}");
|
||||||
|
var availableWidth = ImGui.GetContentRegionAvail().X;
|
||||||
|
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||||
|
{
|
||||||
|
if (ImGui.Button(FontAwesomeIcon.Undo.ToIconString(), new Vector2(availableWidth, 0)))
|
||||||
|
{
|
||||||
|
UIColors.Reset(colorKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UiSharedService.AttachToolTip("Reset this color to default");
|
||||||
}
|
}
|
||||||
UiSharedService.AttachToolTip("Reset this color to default");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
@@ -2263,4 +2284,4 @@ public class SettingsUi : WindowMediatorSubscriberBase
|
|||||||
_wasOpen = IsOpen;
|
_wasOpen = IsOpen;
|
||||||
IsOpen = false;
|
IsOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user