| 1 | #nullable enable |
| 2 | |
| 3 | using CascadeIDE.Features.Chat; |
| 4 | using SkiaSharp; |
| 5 | |
| 6 | namespace CascadeIDE.Views.SkiaKit; |
| 7 | |
| 8 | /// <summary>Палитра slash-preview: Kind → <see cref="SlashCommandPreviewVisualMapper"/> → chip.</summary> |
| 9 | internal static class SkiaSlashPreviewChrome |
| 10 | { |
| 11 | public static SKColor PreviewTextColor(ISkiaKitPaintTheme theme, SlashCommandPreviewKind kind) => |
| 12 | ChipColors(theme, kind).Accent; |
| 13 | |
| 14 | public static SkiaStatusChipColors ChipColors( |
| 15 | ISkiaKitPaintTheme theme, |
| 16 | SlashCommandPreviewKind kind) => |
| 17 | SkiaStatusChip.ResolveColors(theme, ToChipSeverity(kind)); |
| 18 | |
| 19 | internal static SkiaStatusChipSeverity ToChipSeverity(SlashCommandPreviewKind kind) => |
| 20 | ToChipSeverity(SlashCommandPreviewVisualMapper.ToChromeSeverity(kind)); |
| 21 | |
| 22 | internal static SkiaStatusChipSeverity ToChipSeverity(SlashPreviewChromeSeverity severity) => |
| 23 | severity switch |
| 24 | { |
| 25 | SlashPreviewChromeSeverity.Success => SkiaStatusChipSeverity.Success, |
| 26 | SlashPreviewChromeSeverity.Warning => SkiaStatusChipSeverity.Warning, |
| 27 | SlashPreviewChromeSeverity.Error => SkiaStatusChipSeverity.Error, |
| 28 | SlashPreviewChromeSeverity.Info => SkiaStatusChipSeverity.Info, |
| 29 | SlashPreviewChromeSeverity.None => SkiaStatusChipSeverity.None, |
| 30 | _ => throw new ArgumentOutOfRangeException(nameof(severity), severity, "Unmapped SlashPreviewChromeSeverity."), |
| 31 | }; |
| 32 | } |
| 33 | |