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:
@@ -35,7 +35,7 @@
|
|||||||
### True Transparent Background
|
### True Transparent Background
|
||||||
|
|
||||||
- Transparent theme now uses the terminal's native background instead of solid black
|
- Transparent theme now uses the terminal's native background instead of solid black
|
||||||
- Powered by `Color.Transparent` (alpha=0) which emits ANSI `CSI 49m` (default background) instead of explicit RGB
|
- Powered by `Color.None` (alpha=0) which emits ANSI `CSI 49m` (default background) instead of explicit RGB
|
||||||
- Terminal transparency, acrylic, wallpaper effects now show through the TUI
|
- Terminal transparency, acrylic, wallpaper effects now show through the TUI
|
||||||
- Dialogs retain solid `DarkGray` background for readability
|
- Dialogs retain solid `DarkGray` background for readability
|
||||||
- Uses local Terminal.Gui fork (submodule) with transparent color support pending upstream merge ([gui-cs/Terminal.Gui#4234](https://github.com/gui-cs/Terminal.Gui/pull/4234))
|
- Uses local Terminal.Gui fork (submodule) with transparent color support pending upstream merge ([gui-cs/Terminal.Gui#4234](https://github.com/gui-cs/Terminal.Gui/pull/4234))
|
||||||
|
|||||||
@@ -418,16 +418,16 @@ public static class ThemeManager
|
|||||||
Base = new ThemeColors
|
Base = new ThemeColors
|
||||||
{
|
{
|
||||||
Foreground = "White",
|
Foreground = "White",
|
||||||
Background = "Transparent",
|
Background = "None",
|
||||||
FocusForeground = "BrightCyan",
|
FocusForeground = "BrightCyan",
|
||||||
FocusBackground = "Transparent"
|
FocusBackground = "None"
|
||||||
},
|
},
|
||||||
Menu = new ThemeColors
|
Menu = new ThemeColors
|
||||||
{
|
{
|
||||||
Foreground = "White",
|
Foreground = "White",
|
||||||
Background = "Transparent",
|
Background = "None",
|
||||||
FocusForeground = "BrightCyan",
|
FocusForeground = "BrightCyan",
|
||||||
FocusBackground = "Transparent"
|
FocusBackground = "None"
|
||||||
},
|
},
|
||||||
Dialog = new ThemeColors
|
Dialog = new ThemeColors
|
||||||
{
|
{
|
||||||
@@ -439,9 +439,9 @@ public static class ThemeManager
|
|||||||
Status = new ThemeColors
|
Status = new ThemeColors
|
||||||
{
|
{
|
||||||
Foreground = "Gray",
|
Foreground = "Gray",
|
||||||
Background = "Transparent",
|
Background = "None",
|
||||||
FocusForeground = "Gray",
|
FocusForeground = "Gray",
|
||||||
FocusBackground = "Transparent"
|
FocusBackground = "None"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ public sealed class AudioPlayerDialog
|
|||||||
private const int WaveBarCount = 24;
|
private const int WaveBarCount = 24;
|
||||||
private const int AnimationIntervalMs = 150;
|
private const int AnimationIntervalMs = 150;
|
||||||
|
|
||||||
private static readonly Attribute WaveActiveAttr = new(new Color(180, 100, 255), 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.Transparent);
|
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.Transparent);
|
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.Transparent);
|
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.Transparent);
|
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.Transparent);
|
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)
|
public static void Show(IApplication app, AudioPlaybackService audioService, string filePath, string fileName)
|
||||||
{
|
{
|
||||||
@@ -213,7 +213,7 @@ public sealed class AudioPlayerDialog
|
|||||||
fileLabel.DrawingContent += (s, e) =>
|
fileLabel.DrawingContent += (s, e) =>
|
||||||
{
|
{
|
||||||
var normalAttr = fileLabel.GetAttributeForRole(VisualRole.Normal);
|
var normalAttr = fileLabel.GetAttributeForRole(VisualRole.Normal);
|
||||||
var resolvedAttr = FileNameAttr.Background == Color.Transparent
|
var resolvedAttr = FileNameAttr.Background == Color.None
|
||||||
? FileNameAttr with { Background = normalAttr.Background }
|
? FileNameAttr with { Background = normalAttr.Background }
|
||||||
: FileNameAttr;
|
: FileNameAttr;
|
||||||
fileLabel.SetAttribute(resolvedAttr);
|
fileLabel.SetAttribute(resolvedAttr);
|
||||||
@@ -233,7 +233,7 @@ public sealed class AudioPlayerDialog
|
|||||||
{
|
{
|
||||||
var normalAttr = waveLabel.GetAttributeForRole(VisualRole.Normal);
|
var normalAttr = waveLabel.GetAttributeForRole(VisualRole.Normal);
|
||||||
var attr = (audioService.IsPlaying && !audioService.IsPaused) ? WaveActiveAttr : WaveIdleAttr;
|
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 with { Background = normalAttr.Background }
|
||||||
: attr;
|
: attr;
|
||||||
waveLabel.SetAttribute(resolvedAttr);
|
waveLabel.SetAttribute(resolvedAttr);
|
||||||
@@ -259,7 +259,7 @@ public sealed class AudioPlayerDialog
|
|||||||
else
|
else
|
||||||
attr = StatusStoppedAttr;
|
attr = StatusStoppedAttr;
|
||||||
|
|
||||||
var resolvedAttr = attr.Background == Color.Transparent
|
var resolvedAttr = attr.Background == Color.None
|
||||||
? attr with { Background = normalAttr.Background }
|
? attr with { Background = normalAttr.Background }
|
||||||
: attr;
|
: attr;
|
||||||
statusLabel.SetAttribute(resolvedAttr);
|
statusLabel.SetAttribute(resolvedAttr);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public partial class ChatLine
|
|||||||
Color? currentFg = null;
|
Color? currentFg = null;
|
||||||
Color? currentBg = null;
|
Color? currentBg = null;
|
||||||
var defaultFg = defaultAttr?.Foreground;
|
var defaultFg = defaultAttr?.Foreground;
|
||||||
var defaultBg = defaultAttr?.Background ?? Color.Transparent;
|
var defaultBg = defaultAttr?.Background ?? Color.None;
|
||||||
|
|
||||||
Attribute? BuildAttr()
|
Attribute? BuildAttr()
|
||||||
{
|
{
|
||||||
@@ -250,7 +250,7 @@ public class ChatListSource : IListDataSource
|
|||||||
foreach (var segment in chatLine.Segments)
|
foreach (var segment in chatLine.Segments)
|
||||||
{
|
{
|
||||||
var attr = segment.Color ?? normalAttr;
|
var attr = segment.Color ?? normalAttr;
|
||||||
if (attr.Background == Color.Transparent)
|
if (attr.Background == Color.None)
|
||||||
attr = attr with { Background = normalAttr.Background };
|
attr = attr with { Background = normalAttr.Background };
|
||||||
if (mentionBg.HasValue)
|
if (mentionBg.HasValue)
|
||||||
attr = attr with { Background = mentionBg.Value };
|
attr = attr with { Background = mentionBg.Value };
|
||||||
@@ -304,10 +304,10 @@ public class ChannelListSource : IListDataSource
|
|||||||
public int MaxItemLength { get; private set; }
|
public int MaxItemLength { get; private set; }
|
||||||
public bool SuspendCollectionChangedEvent { get; set; }
|
public bool SuspendCollectionChangedEvent { get; set; }
|
||||||
|
|
||||||
private static readonly Attribute ActiveAttr = new(Color.White, Color.Transparent);
|
private static readonly Attribute ActiveAttr = new(Color.White, Color.None);
|
||||||
private static readonly Attribute UnreadAttr = new(Color.BrightCyan, Color.Transparent);
|
private static readonly Attribute UnreadAttr = new(Color.BrightCyan, Color.None);
|
||||||
private static readonly Attribute NormalAttr = new(Color.DarkGray, Color.Transparent);
|
private static readonly Attribute NormalAttr = new(Color.DarkGray, Color.None);
|
||||||
private static readonly Attribute BadgeAttr = new(Color.BrightYellow, Color.Transparent);
|
private static readonly Attribute BadgeAttr = new(Color.BrightYellow, Color.None);
|
||||||
|
|
||||||
public void Update(List<string> channels, Dictionary<string, int> unread, string activeChannel)
|
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
|
// Resolve Transparent backgrounds to the view's actual background
|
||||||
Attribute Resolve(Attribute attr) =>
|
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;
|
int drawnChars = 0;
|
||||||
|
|
||||||
@@ -479,16 +479,16 @@ static class RenderHelpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static partial class ChatColors
|
public static partial class ChatColors
|
||||||
{
|
{
|
||||||
public static readonly Attribute TimestampAttr = new(Color.DarkGray, Color.Transparent);
|
public static readonly Attribute TimestampAttr = new(Color.DarkGray, Color.None);
|
||||||
public static readonly Attribute SystemAttr = new(new Color(0, 180, 180), Color.Transparent);
|
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 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 MentionTextAttr = new(new Color(255, 180, 50), Color.None);
|
||||||
public static readonly Attribute EmbedBorderAttr = new(new Color(91, 155, 213), Color.Transparent);
|
public static readonly Attribute EmbedBorderAttr = new(new Color(91, 155, 213), Color.None);
|
||||||
public static readonly Attribute EmbedTitleAttr = new(Color.White, Color.Transparent);
|
public static readonly Attribute EmbedTitleAttr = new(Color.White, Color.None);
|
||||||
public static readonly Attribute EmbedDescAttr = new(new Color(160, 160, 160), Color.Transparent);
|
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.Transparent);
|
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.Transparent);
|
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.Transparent);
|
public static readonly Attribute FileAttr = new(new Color(100, 180, 255), Color.None);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Split text around @mentions, giving each @word the MentionTextAttr accent color.
|
/// 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 r = Convert.ToInt32(hex[..2], 16);
|
||||||
var g = Convert.ToInt32(hex[2..4], 16);
|
var g = Convert.ToInt32(hex[2..4], 16);
|
||||||
var b = Convert.ToInt32(hex[4..6], 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
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -712,10 +712,10 @@ public sealed class MainWindow : Runnable
|
|||||||
_statusLabel.SetNeedsDraw();
|
_statusLabel.SetNeedsDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Attribute StatusConnectedAttr = new(new Color(0, 200, 0), 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.Transparent);
|
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.Transparent);
|
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.Transparent);
|
private static readonly Attribute StatusBrandAttr = new(new Color(218, 165, 32), Color.None);
|
||||||
|
|
||||||
private void OnStatusBarDrawContent(object? sender, DrawEventArgs e)
|
private void OnStatusBarDrawContent(object? sender, DrawEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -724,9 +724,9 @@ public sealed class MainWindow : Runnable
|
|||||||
var width = _statusLabel.Viewport.Width;
|
var width = _statusLabel.Viewport.Width;
|
||||||
if (width <= 0) return;
|
if (width <= 0) return;
|
||||||
|
|
||||||
// Resolve transparent background for colored segments
|
// Resolve None background for colored segments
|
||||||
var bg = normalAttr.Background;
|
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;
|
int col = 0;
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule src/Terminal.Gui updated: acc7b81923...0061d03558
Reference in New Issue
Block a user