mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
fix: update transparent color handling to use 'None' instead of 'Transparent' across UI components
This commit is contained in:
@@ -14,12 +14,12 @@ public sealed class AudioPlayerDialog
|
||||
private const int WaveBarCount = 24;
|
||||
private const int AnimationIntervalMs = 150;
|
||||
|
||||
private static readonly Attribute WaveActiveAttr = new(new Color(180, 100, 255), Color.Transparent);
|
||||
private static readonly Attribute WaveIdleAttr = new(new Color(80, 50, 120), Color.Transparent);
|
||||
private static readonly Attribute FileNameAttr = new(new Color(180, 100, 255), Color.Transparent);
|
||||
private static readonly Attribute StatusPlayingAttr = new(new Color(0, 200, 0), Color.Transparent);
|
||||
private static readonly Attribute StatusPausedAttr = new(new Color(220, 180, 0), Color.Transparent);
|
||||
private static readonly Attribute StatusStoppedAttr = new(new Color(160, 160, 160), Color.Transparent);
|
||||
private static readonly Attribute WaveActiveAttr = new(new Color(180, 100, 255), Color.None);
|
||||
private static readonly Attribute WaveIdleAttr = new(new Color(80, 50, 120), Color.None);
|
||||
private static readonly Attribute FileNameAttr = new(new Color(180, 100, 255), Color.None);
|
||||
private static readonly Attribute StatusPlayingAttr = new(new Color(0, 200, 0), Color.None);
|
||||
private static readonly Attribute StatusPausedAttr = new(new Color(220, 180, 0), Color.None);
|
||||
private static readonly Attribute StatusStoppedAttr = new(new Color(160, 160, 160), Color.None);
|
||||
|
||||
public static void Show(IApplication app, AudioPlaybackService audioService, string filePath, string fileName)
|
||||
{
|
||||
@@ -213,7 +213,7 @@ public sealed class AudioPlayerDialog
|
||||
fileLabel.DrawingContent += (s, e) =>
|
||||
{
|
||||
var normalAttr = fileLabel.GetAttributeForRole(VisualRole.Normal);
|
||||
var resolvedAttr = FileNameAttr.Background == Color.Transparent
|
||||
var resolvedAttr = FileNameAttr.Background == Color.None
|
||||
? FileNameAttr with { Background = normalAttr.Background }
|
||||
: FileNameAttr;
|
||||
fileLabel.SetAttribute(resolvedAttr);
|
||||
@@ -233,7 +233,7 @@ public sealed class AudioPlayerDialog
|
||||
{
|
||||
var normalAttr = waveLabel.GetAttributeForRole(VisualRole.Normal);
|
||||
var attr = (audioService.IsPlaying && !audioService.IsPaused) ? WaveActiveAttr : WaveIdleAttr;
|
||||
var resolvedAttr = attr.Background == Color.Transparent
|
||||
var resolvedAttr = attr.Background == Color.None
|
||||
? attr with { Background = normalAttr.Background }
|
||||
: attr;
|
||||
waveLabel.SetAttribute(resolvedAttr);
|
||||
@@ -259,7 +259,7 @@ public sealed class AudioPlayerDialog
|
||||
else
|
||||
attr = StatusStoppedAttr;
|
||||
|
||||
var resolvedAttr = attr.Background == Color.Transparent
|
||||
var resolvedAttr = attr.Background == Color.None
|
||||
? attr with { Background = normalAttr.Background }
|
||||
: attr;
|
||||
statusLabel.SetAttribute(resolvedAttr);
|
||||
|
||||
@@ -131,7 +131,7 @@ public partial class ChatLine
|
||||
Color? currentFg = null;
|
||||
Color? currentBg = null;
|
||||
var defaultFg = defaultAttr?.Foreground;
|
||||
var defaultBg = defaultAttr?.Background ?? Color.Transparent;
|
||||
var defaultBg = defaultAttr?.Background ?? Color.None;
|
||||
|
||||
Attribute? BuildAttr()
|
||||
{
|
||||
@@ -250,7 +250,7 @@ public class ChatListSource : IListDataSource
|
||||
foreach (var segment in chatLine.Segments)
|
||||
{
|
||||
var attr = segment.Color ?? normalAttr;
|
||||
if (attr.Background == Color.Transparent)
|
||||
if (attr.Background == Color.None)
|
||||
attr = attr with { Background = normalAttr.Background };
|
||||
if (mentionBg.HasValue)
|
||||
attr = attr with { Background = mentionBg.Value };
|
||||
@@ -304,10 +304,10 @@ public class ChannelListSource : IListDataSource
|
||||
public int MaxItemLength { get; private set; }
|
||||
public bool SuspendCollectionChangedEvent { get; set; }
|
||||
|
||||
private static readonly Attribute ActiveAttr = new(Color.White, Color.Transparent);
|
||||
private static readonly Attribute UnreadAttr = new(Color.BrightCyan, Color.Transparent);
|
||||
private static readonly Attribute NormalAttr = new(Color.DarkGray, Color.Transparent);
|
||||
private static readonly Attribute BadgeAttr = new(Color.BrightYellow, Color.Transparent);
|
||||
private static readonly Attribute ActiveAttr = new(Color.White, Color.None);
|
||||
private static readonly Attribute UnreadAttr = new(Color.BrightCyan, Color.None);
|
||||
private static readonly Attribute NormalAttr = new(Color.DarkGray, Color.None);
|
||||
private static readonly Attribute BadgeAttr = new(Color.BrightYellow, Color.None);
|
||||
|
||||
public void Update(List<string> channels, Dictionary<string, int> unread, string activeChannel)
|
||||
{
|
||||
@@ -343,7 +343,7 @@ public class ChannelListSource : IListDataSource
|
||||
|
||||
// Resolve Transparent backgrounds to the view's actual background
|
||||
Attribute Resolve(Attribute attr) =>
|
||||
attr.Background == Color.Transparent ? attr with { Background = normalAttr.Background } : attr;
|
||||
attr.Background == Color.None ? attr with { Background = normalAttr.Background } : attr;
|
||||
|
||||
int drawnChars = 0;
|
||||
|
||||
@@ -479,16 +479,16 @@ static class RenderHelpers
|
||||
/// </summary>
|
||||
public static partial class ChatColors
|
||||
{
|
||||
public static readonly Attribute TimestampAttr = new(Color.DarkGray, Color.Transparent);
|
||||
public static readonly Attribute SystemAttr = new(new Color(0, 180, 180), Color.Transparent);
|
||||
public static readonly Attribute TimestampAttr = new(Color.DarkGray, Color.None);
|
||||
public static readonly Attribute SystemAttr = new(new Color(0, 180, 180), Color.None);
|
||||
public static readonly Attribute MentionHighlightAttr = new(Color.White, new Color(80, 40, 0));
|
||||
public static readonly Attribute MentionTextAttr = new(new Color(255, 180, 50), Color.Transparent);
|
||||
public static readonly Attribute EmbedBorderAttr = new(new Color(91, 155, 213), Color.Transparent);
|
||||
public static readonly Attribute EmbedTitleAttr = new(Color.White, Color.Transparent);
|
||||
public static readonly Attribute EmbedDescAttr = new(new Color(160, 160, 160), Color.Transparent);
|
||||
public static readonly Attribute EmbedUrlAttr = new(new Color(100, 100, 100), Color.Transparent);
|
||||
public static readonly Attribute AudioAttr = new(new Color(180, 100, 255), Color.Transparent);
|
||||
public static readonly Attribute FileAttr = new(new Color(100, 180, 255), Color.Transparent);
|
||||
public static readonly Attribute MentionTextAttr = new(new Color(255, 180, 50), Color.None);
|
||||
public static readonly Attribute EmbedBorderAttr = new(new Color(91, 155, 213), Color.None);
|
||||
public static readonly Attribute EmbedTitleAttr = new(Color.White, Color.None);
|
||||
public static readonly Attribute EmbedDescAttr = new(new Color(160, 160, 160), Color.None);
|
||||
public static readonly Attribute EmbedUrlAttr = new(new Color(100, 100, 100), Color.None);
|
||||
public static readonly Attribute AudioAttr = new(new Color(180, 100, 255), Color.None);
|
||||
public static readonly Attribute FileAttr = new(new Color(100, 180, 255), Color.None);
|
||||
|
||||
/// <summary>
|
||||
/// Split text around @mentions, giving each @word the MentionTextAttr accent color.
|
||||
@@ -537,7 +537,7 @@ public static class ColorHelper
|
||||
var r = Convert.ToInt32(hex[..2], 16);
|
||||
var g = Convert.ToInt32(hex[2..4], 16);
|
||||
var b = Convert.ToInt32(hex[4..6], 16);
|
||||
return new Attribute(new Color(r, g, b), Color.Transparent);
|
||||
return new Attribute(new Color(r, g, b), Color.None);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -712,10 +712,10 @@ public sealed class MainWindow : Runnable
|
||||
_statusLabel.SetNeedsDraw();
|
||||
}
|
||||
|
||||
private static readonly Attribute StatusConnectedAttr = new(new Color(0, 200, 0), Color.Transparent);
|
||||
private static readonly Attribute StatusDisconnectedAttr = new(new Color(220, 50, 50), Color.Transparent);
|
||||
private static readonly Attribute StatusTransitionalAttr = new(new Color(220, 180, 0), Color.Transparent);
|
||||
private static readonly Attribute StatusBrandAttr = new(new Color(218, 165, 32), Color.Transparent);
|
||||
private static readonly Attribute StatusConnectedAttr = new(new Color(0, 200, 0), Color.None);
|
||||
private static readonly Attribute StatusDisconnectedAttr = new(new Color(220, 50, 50), Color.None);
|
||||
private static readonly Attribute StatusTransitionalAttr = new(new Color(220, 180, 0), Color.None);
|
||||
private static readonly Attribute StatusBrandAttr = new(new Color(218, 165, 32), Color.None);
|
||||
|
||||
private void OnStatusBarDrawContent(object? sender, DrawEventArgs e)
|
||||
{
|
||||
@@ -724,9 +724,9 @@ public sealed class MainWindow : Runnable
|
||||
var width = _statusLabel.Viewport.Width;
|
||||
if (width <= 0) return;
|
||||
|
||||
// Resolve transparent background for colored segments
|
||||
// Resolve None background for colored segments
|
||||
var bg = normalAttr.Background;
|
||||
Attribute Resolve(Attribute a) => a.Background == Color.Transparent ? a with { Background = bg } : a;
|
||||
Attribute Resolve(Attribute a) => a.Background == Color.None ? a with { Background = bg } : a;
|
||||
|
||||
int col = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user