A1: scharfschalten DrawHoverSheen accent-tint (Variante A)

This commit is contained in:
2026-06-16 12:17:39 +02:00
parent f5ba1c0246
commit 7ead120213
@@ -12,9 +12,16 @@ namespace HellionChat.Ui.StyleEngine;
// ABGR before delegating to ImDrawList. Hover-sheen state lives in a small
// static dictionary keyed by constant strings — keep keys constant and
// scope to static UI elements so the per-key footprint stays bounded.
// TEST-MIRROR: Util/ColourUtilTintTests.cs
internal static class DrawListExtensions
{
private const float SheenDurationSeconds = 0.65f;
// A1 accent-tint (Variante A): how far the white sweep is pulled toward
// the element's accent hue. Kept low so the sheen reads as a tinted
// highlight, not a saturated accent flash (effect level "subtle").
private const float SheenTintStrength = 0.35f;
private static readonly Dictionary<string, DateTime> SheenStarts = new();
public static void DrawHoverSheen(
@@ -46,7 +53,11 @@ internal static class DrawListExtensions
var t = (float)(elapsed / SheenDurationSeconds);
var alpha = (byte)Math.Round(0x40 * (1f - t));
var sheenAbgr = ((uint)alpha << 24) | 0x00FFFFFFu;
// Tint the sweep toward the accent hue, then stamp the falloff alpha.
// accentRgba is RGBA; convert to ABGR FIRST or the draw-list swaps R/B.
var accentAbgr = ColourUtil.RgbaToAbgr(accentRgba);
var tintedRgb = ColourUtil.LerpTowardWhite(accentAbgr, SheenTintStrength) & 0x00FFFFFFu;
var sheenAbgr = ((uint)alpha << 24) | tintedRgb;
var sweepX = min.X + (max.X - min.X) * t;
dl.AddRectFilled(
new Vector2(sweepX - 12f, min.Y),
@@ -54,11 +65,6 @@ internal static class DrawListExtensions
sheenAbgr,
2f
);
// Accent currently unused — reserved for a tinted-sweep variant that
// tracks the element's accent hue. Keeping it in the signature so
// call-sites don't churn when the tinted path lands.
_ = accentRgba;
}
public static void DrawGlowBorder(