SharpConsoleUI

A terminal GUI framework for .NET.

Per-cell alpha blending, double-buffered compositing with occlusion culling, and a Measure→Arrange→Paint layout pipeline. Each window runs on its own async thread. Gradient backgrounds propagate through every transparent control automatically.

NuGet Documentation Build
Watch demo on YouTube
SharpConsoleUI
SharpConsoleUI — feature explorer
Gradient compositor — propagation through transparent controls

// Real Compositor

Gradient backgrounds propagate through every transparent control automatically — DataGrids, containers, margins, all transparent to the compositor beneath. No control needs to know the gradient exists. Per-cell alpha blending on foreground and background: write [#00FF0080]50% alpha[/] in any label, on any control, and the compositor handles the rest.

Async Windows — multiple independent windows running simultaneously

// Async Windows

Each window runs on its own async thread and updates independently. Multiple panels animate simultaneously without blocking each other. No timer juggling — just async/await and CancellationToken.

CanvasControl — plasma, geometry primitives, starfield

// CanvasControl

30+ drawing primitives — lines, arcs, circles, rectangles, polygons, beziers, text, gradients — in both retained and immediate rendering modes. Plasma effects, particle systems, interactive ripples, geometry scenes. Full mouse event support. Drop it in any window like any other control.

Full Unicode — CJK, emoji, RTL, surrogate pairs

// Full Unicode

CJK wide characters, surrogate pair emoji, RTL scripts, regional indicator flags — correct at the cell level throughout the compositor, diff renderer, and ANSI output. Width-aware everywhere, not an afterthought.

Unique Controls — PTY terminal running btop with character-perfect ANSI capture

// Unique Controls

PTY-backed terminal emulator: run a real shell — bash, vim, btop — inside a UI panel with character-perfect ANSI capture. ImageControl renders PNG, JPEG, WebP via half-block Unicode. CanvasControl with 30+ drawing primitives. SpectreRenderableControl wraps any Spectre.Console IRenderable natively.

Markup Everywhere — rich text on all controls with alpha support

// Markup Everywhere

Write [red]alert[/] in any string, on any control, without a second thought. Named colors, RGB, full RGBA hex ([#FF000080]50% alpha[/]), bold, italic, underline, background colors, nested styles — composited through the alpha pipeline just like everything else.

Alpha blending — per-cell RGBA compositing

// Alpha Blending

Porter-Duff compositing at the cell level — foreground and background independently alpha-composited on every render pass. Glass panels, pulse effects, animated alpha, gradient-transparent controls. Write [#00FF0080] anywhere and the compositor does the rest. No other .NET terminal library does this.

Video playback — half-block, ASCII and braille render modes

// Video Playback

Play MP4, MKV, WebM and more directly inside a window. FFmpeg decodes frames; three render modes — half-block (best color), ASCII (density ramp), braille (highest resolution) — convert pixels to terminal cells at up to 30 fps. Auto-resize on window drag, overlay status bar, looping. No other terminal UI framework plays video.

What only SharpConsoleUI does

Capabilities absent from every other .NET terminal UI library.

#01
Gradient compositor

Window gradients propagate through every transparent control automatically. DataGrids, containers, margins — all transparent to the compositor beneath. No control needs to know the gradient exists.

#02
Full RGBA alpha

Porter-Duff compositing at the cell level. Glass panels. Animated alpha. Pulse effects. Foreground and background independently alpha-composited against whatever the compositor has already rendered.

#03
PreBufferPaint / PostBufferPaint

Full Cell[,] access before and after every render pass. Animated backgrounds, blur, color grading, fractals — anything that operates on the raw cell buffer.

#04
Per-window async threads

Each window is an async Task. Multiple panels update simultaneously at different rates without coordination. Natural, not engineered.

#05
PTY terminal emulator

TerminalControl embeds a real shell process inside a UI panel. Run bash, vim, htop inside your application. Linux only.

#06
Image rendering

ImageControl displays PNG, JPEG, WebP and more via half-block Unicode. Fit, Fill, Stretch, None scale modes.

#07
Animation pipeline

Time-based tweened animations with easing functions built on PostBufferPaint. FadeIn, FadeOut, SlideIn, custom effects.

#08
Spectre.Console bridge

SpectreRenderableControl wraps any IRenderable as a native control. Every Spectre widget works inside SharpConsoleUI windows without modification.

#09
Video playback

VideoControl plays MP4/MKV/WebM via FFmpeg in three render modes: half-block (best color), ASCII (density ramp), braille (highest resolution). Auto-resize, overlay bar, looping.

SHELL
dotnet add package SharpConsoleUI
C#
using SharpConsoleUI;
using SharpConsoleUI.Builders;
using SharpConsoleUI.Configuration;
using SharpConsoleUI.Controls;
using SharpConsoleUI.Helpers;

var windowSystem = new ConsoleWindowSystem(
    new NetConsoleDriver(RenderMode.Buffer));

var gradient = ColorGradient.FromColors(
    new Color(0, 20, 60),
    new Color(0, 5, 20));

var window = new WindowBuilder(windowSystem)
    .WithTitle("SharpConsoleUI")
    .WithSize(70, 22)
    .Centered()
    .WithBackgroundGradient(gradient, GradientDirection.Vertical)
    .Build();

// PreBufferPaint — fires before controls paint
window.PreBufferPaint += (buffer, dirty, clip) =>
{
    // Animated background, fractal, pattern —
    // whatever you want beneath the controls
};

// PostBufferPaint — fires after controls paint
window.PostBufferPaint += (buffer, dirty, clip) =>
{
    // Color grade, blur, overlay effects
};

// Controls inherit the gradient — no background needed
window.AddControl(new MarkupControl(new List<string>
{
    "[bold cyan]Real compositor. Full alpha blending.[/]",
    "[dim]The terminal is just the output surface.[/]",
    "",
    "[#FF000080]This text has 50% alpha foreground[/]",
    "Controls are transparent to the gradient beneath."
}));

windowSystem.AddWindow(window);
windowSystem.Run();