Files
ClaudeDo/src/ClaudeDo.Ui/Converters/LogKindForegroundConverter.cs
T
Mika Kuns 786eb2877f feat(ui): highlight user chat messages + opt-in interrupt (stop) button
LogKindForegroundConverter drives the log message foreground via a local
binding (beats the dim local value), so user messages render in the accent
color instead of vanishing into the transcript. Adds a small stop (Icon.Stop)
button next to Send in both composers (SessionTerminalView + WorkConsole) wired
to InterruptInteractiveCommand → InterruptInteractiveSessionAsync. Adds
session.composer.interrupt (en/de).
2026-06-26 16:11:52 +02:00

44 lines
1.3 KiB
C#

using System.Globalization;
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media;
using Avalonia.Styling;
using ClaudeDo.Ui.ViewModels.Islands;
namespace ClaudeDo.Ui.Converters;
public sealed class LogKindForegroundConverter : IValueConverter
{
private static IBrush? Resolve(string key)
{
if (Application.Current is { } app &&
app.Resources.TryGetResource(key, app.ActualThemeVariant, out var res) &&
res is IBrush brush)
{
return brush;
}
return null;
}
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
var key = value is LogKind kind ? kind switch
{
LogKind.Sys => "TextMuteBrush",
LogKind.Tool => "SageBrush",
LogKind.Claude => "TextBrush",
LogKind.Stdout => "TextDimBrush",
LogKind.Stderr => "BloodBrush",
LogKind.Done => "MossBrightBrush",
LogKind.Msg => "TextDimBrush",
LogKind.User => "AccentBrush",
_ => "TextDimBrush",
} : "TextDimBrush";
return Resolve(key) ?? AvaloniaProperty.UnsetValue;
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) =>
throw new NotSupportedException();
}