diff --git a/HellionChat/Ui/Components/Settings/LivePreviewPanel.cs b/HellionChat/Ui/Components/Settings/LivePreviewPanel.cs index 4621996..3bf96c1 100644 --- a/HellionChat/Ui/Components/Settings/LivePreviewPanel.cs +++ b/HellionChat/Ui/Components/Settings/LivePreviewPanel.cs @@ -11,6 +11,13 @@ namespace HellionChat.Ui.Components.Settings; internal sealed class LivePreviewPanel : IDisposable { + // The preview reads the same tokens the real chrome does. Copying their lerp + // formulas here is how it drifted out of sync in the first place. + private static readonly StyleEngine.TokenResolver Tokens = new(); + + private static uint Abgr(StyleEngine.Token token, ThemeColors colors) => + ColourUtil.RgbaToAbgr(Tokens.Resolve(token, colors)); + // Static counter for S5 reload-stress verification: after 10 reloads the // counter must read 0 (plugin disabled) or 1 (plugin enabled). Anything // higher signals a Dispose skip and a subscriber leak against ThemeRegistry. @@ -177,6 +184,8 @@ internal sealed class LivePreviewPanel : IDisposable var rowHeight = MiddleBandHeight / 3f; var surface = ColourUtil.RgbaToAbgr(theme.Colors.Surface); var surfaceHover = ColourUtil.RgbaToAbgr(theme.Colors.SurfaceHover); + + var surfaceActive = Abgr(StyleEngine.Token.SurfaceActive, theme.Colors); var textAbgr = ColourUtil.RgbaToAbgr(theme.Colors.TextPrimary); var primaryAbgr = ColourUtil.RgbaToAbgr(theme.Colors.Primary); var accentAbgr = ColourUtil.RgbaToAbgr(theme.Colors.Accent); @@ -193,7 +202,7 @@ internal sealed class LivePreviewPanel : IDisposable var rowMax = new Vector2(origin.X + SidebarWidth, rowMin.Y + rowHeight); var isActive = i == 0; - draw.AddRectFilled(rowMin, rowMax, isActive ? surfaceHover : surface); + draw.AddRectFilled(rowMin, rowMax, isActive ? surfaceActive : surface); if (isActive) draw.AddRectFilled(rowMin, new Vector2(rowMin.X + 2f, rowMax.Y), primaryAbgr); @@ -339,7 +348,7 @@ internal sealed class LivePreviewPanel : IDisposable 1f ); - var fill = ColourUtil.RgbaToAbgr(theme.Colors.SurfaceHover); + var fill = Abgr(StyleEngine.Token.SurfaceRaised, theme.Colors); var textAbgr = ColourUtil.RgbaToAbgr(theme.Colors.TextPrimary); var pillY = origin.Y + (height - pillH) * 0.5f; @@ -387,7 +396,7 @@ internal sealed class LivePreviewPanel : IDisposable ); draw.AddText( new Vector2(versionMin.X + padX, pillY + (pillH - versionSize.Y) * 0.5f), - ColourUtil.RgbaToAbgr(theme.Colors.TextDim), + ColourUtil.RgbaToAbgr(theme.Colors.TextMuted), label );