few changes:

- sending a successful pair request through context menu while a pending one exists in client clears it
- adjustments to higlight coloring, preventing any text colors to blend with the highlight
- some text adjustments
- editing uid color in profile editor also previews the highlight
This commit is contained in:
2025-10-05 03:28:02 +09:00
parent 25d39c0ad1
commit 8dd13479fc
7 changed files with 132 additions and 29 deletions

View File

@@ -9,6 +9,7 @@ using LightlessSync.API.Data;
using LightlessSync.API.Dto.User;
using LightlessSync.Services;
using LightlessSync.Services.Mediator;
using LightlessSync.UI.Style;
using LightlessSync.Utils;
using LightlessSync.WebAPI;
using Microsoft.Extensions.Logging;
@@ -33,6 +34,7 @@ public class EditProfileUi : WindowMediatorSubscriberBase
private bool _showFileDialogError = false;
private bool _wasOpen;
private Vector4 _currentBg = new(0.15f, 0.15f, 0.15f, 1f);
private bool vanityInitialized; // useless for now
private bool textEnabled;
private bool glowEnabled;
@@ -303,22 +305,37 @@ public class EditProfileUi : WindowMediatorSubscriberBase
using (ImRaii.PushFont(font))
{
var offsetX = 10f;
var pos = ImGui.GetCursorScreenPos() + new Vector2(offsetX, 0);
var size = ImGui.CalcTextSize(seString.TextValue);
var drawList = ImGui.GetWindowDrawList();
var textSize = ImGui.CalcTextSize(seString.TextValue);
var padding = new Vector2(6, 3);
var rectMin = pos - padding;
var rectMax = pos + size + padding;
float minWidth = 150f * ImGuiHelpers.GlobalScale;
float bgWidth = Math.Max(textSize.X + 20f, minWidth);
float paddingY = 5f * ImGuiHelpers.GlobalScale;
var cursor = ImGui.GetCursorScreenPos();
var rectMin = cursor;
var rectMax = rectMin + new Vector2(bgWidth, textSize.Y + (paddingY * 2f));
float boost = Luminance.ComputeHighlight(previewTextColor, previewGlowColor);
var baseBg = new Vector4(0.15f + boost, 0.15f + boost, 0.15f + boost, 1f);
var bgColor = Luminance.BackgroundContrast(previewTextColor, previewGlowColor, baseBg, ref _currentBg);
var bgColor = new Vector4(0.15f, 0.15f, 0.15f, 1f);
var borderColor = UIColors.Get("LightlessPurple");
var drawList = ImGui.GetWindowDrawList();
drawList.AddRectFilled(rectMin, rectMax, ImGui.GetColorU32(bgColor), 6.0f);
drawList.AddRect(rectMin, rectMax, ImGui.GetColorU32(borderColor), 6.0f, ImDrawFlags.None, 1.5f);
SeStringUtils.RenderSeStringWithHitbox(seString, pos, font);
var textPos = new Vector2(
rectMin.X + (bgWidth - textSize.X) * 0.5f,
rectMin.Y + paddingY
);
SeStringUtils.RenderSeStringWithHitbox(seString, textPos, font);
ImGui.Dummy(new Vector2(5));
}
const float colorPickAlign = 90f;