DEV Community

Nikolaos Protopapas
Nikolaos Protopapas

Posted on

Building Terminal UIs in .NET: How SharpConsoleUI Complements Terminal.Gui

The .NET terminal UI space has a clear champion: Terminal.Gui, created by Miguel de Icaza — the same mind behind Mono, Xamarin, and GNOME. With 10.7K stars, 1.6M NuGet downloads, and 199 contributors, it's the most mature and widely-used TUI framework in the .NET ecosystem. It set the standard for what's possible in a terminal.

SharpConsoleUI is a much younger, much smaller project that takes a different architectural approach. It doesn't aim to replace Terminal.Gui — it fills a niche that Terminal.Gui wasn't designed for. This post explains the differences so you can pick the right tool for your use case.

Different Problems, Different Architectures

Terminal.Gui follows the classic single-threaded event loop model — the same proven pattern as WinForms. One main loop handles input, layout, and painting. Background work is marshaled back via Application.Invoke(). This is well-understood, safe, and works perfectly for form-based applications, dialogs, and configuration UIs.

SharpConsoleUI uses a multi-threaded compositor model. Each window can have its own async thread updating independently, and the rendering engine composites everything together using a double-buffered cell pipeline with dirty-region tracking. This is closer to how a desktop compositor works — each window paints to its own buffer, and the screen-level buffer diff-scans and outputs only changed cells.

// SharpConsoleUI: Each window updates on its own thread
var monitor = new WindowBuilder(windowSystem)
    .WithTitle("System Monitor [1s refresh]")
    .WithAsyncWindowThread(async (window, ct) =>
    {
        while (!ct.IsCancellationRequested)
        {
            UpdateMetrics(window); // Doesn't block other windows
            await Task.Delay(1000, ct);
        }
    })
    .Build();
Enter fullscreen mode Exit fullscreen mode

Neither approach is objectively better — they solve different problems. Terminal.Gui's model is simpler and safer. SharpConsoleUI's model enables scenarios that are awkward in a single-threaded loop.

Rendering Pipeline

Terminal.Gui v2 has a modern rendering system with TrueColor support, automatic 16-color fallback, and a LineCanvas that handles line intersection merging. Views draw within their bounds, and the framework manages repainting.

SharpConsoleUI implements a DOM-based Measure → Arrange → Paint pipeline (inspired by WPF/Avalonia) with three additional features:

  • Occlusion culling — content hidden behind other windows is never rendered
  • Adaptive rendering — each line is analyzed and rendered as cells or full lines based on coverage heuristics
  • Compositor hooksPreBufferPaint/PostBufferPaint let you manipulate the rendered buffer for effects like blur, fade, or animated backgrounds

All rendering flows through typed Cell structs. ANSI is generated once at the terminal output boundary. On Unix, SharpConsoleUI bypasses .NET's Console infrastructure entirely using raw libc I/O — a technique inspired by Terminal.Gui v2's own approach to solving the terminal echo leak bug.

Controls Comparison

Both frameworks provide rich control libraries:

Category Terminal.Gui v2 SharpConsoleUI
Input Button, CheckBox, RadioGroup, TextField, TextView ButtonControl, CheckboxControl, PromptControl, MultilineEditControl
Data ListView, TableView (sorting/filtering), TreeView ListControl, TableControl, TreeControl
Menus MenuBar, PopoverMenu MenuControl (horizontal/vertical, nested submenus)
Tabs TabView TabControl
Layout FrameView, TileView, ScrollView ColumnContainer, HorizontalGridControl, ScrollablePanelControl, SplitterControl
Dialogs Dialog, FileDialog, Wizard Built-in file picker, folder browser, notification system

Terminal.Gui has more specialized controls: ColorPicker, DatePicker, NumericUpDown, Wizard, CharMap, GraphView, FlagSelector. Its control library is broader — that's the advantage of 8 years and 199 contributors.

SharpConsoleUI has unique controls that don't exist in Terminal.Gui:

  • CanvasControl — Free-form drawing surface with 30+ primitives (circles, polygons, gradients, arcs), supporting retained and immediate rendering modes
  • TerminalControl — Embedded PTY-based terminal emulator (run bash, vim, htop inside your TUI app)
  • SparklineControl — Real-time sparkline graphs (block, braille, bidirectional modes)
  • BarGraphControl — Horizontal bar graphs with gradient color thresholds

Spectre.Console

Terminal.Gui has its own rendering and theming system — it's self-contained.

SharpConsoleUI is built on top of Spectre.Console. Any [bold red]markup[/] works anywhere, and any Spectre IRenderable (Tables, Trees, BarCharts, Panels) can be used as a control via SpectreRenderableControl. If you're already in the Spectre.Console ecosystem, SharpConsoleUI extends it rather than replacing it.

Layout

Terminal.Gui uses Pos and Dim types for powerful relative positioning — Pos.Center(), Pos.Percent(50), Dim.Fill(), Dim.Auto(). This is more expressive for complex layouts.

SharpConsoleUI uses a simpler stack/grid/fill model with alignment properties. It covers common layouts well but doesn't match Terminal.Gui's positioning flexibility.

Terminal.Gui wins on layout expressiveness.

The Numbers

Terminal.Gui SharpConsoleUI
Stars 10,700 36
NuGet Downloads 1.6M 6.4K
Contributors 199 1
First Release 2017 2025
Status v2 beta v2.4 stable
.NET .NET Standard 2.0+ .NET 9.0
License MIT MIT

These numbers tell the story. Terminal.Gui is a mature, community-driven project with years of battle-testing. SharpConsoleUI is a solo project that's been in active development for about a year. If community size and ecosystem maturity are your primary concerns, Terminal.Gui is the obvious choice.

When to Reach for SharpConsoleUI

SharpConsoleUI makes sense when you need something Terminal.Gui wasn't designed around:

  • Multi-window dashboards where each panel updates independently at different rates — the per-window async thread model makes this natural
  • Real-time animations or high-frequency updates — the compositor architecture achieves 25+ fps over SSH
  • Compositor effects — buffer-level post-processing for transitions, blur, custom rendering
  • Embedded terminal emulators — the PTY-based TerminalControl runs real shell processes
  • Free-form drawing — CanvasControl for games, visualizations, or interactive graphics
  • Spectre.Console extension — adding windowing to an existing Spectre.Console project

When to Reach for Terminal.Gui

For most .NET terminal applications, Terminal.Gui is the right choice:

  • Largest community and most third-party resources
  • Broadest .NET compatibility (.NET Standard 2.0)
  • More specialized controls (ColorPicker, DatePicker, Wizard)
  • Proven in production across the ecosystem
  • Familiar WinForms-like programming model
  • Better layout system for complex relative positioning
  • Active development with 199 contributors

Acknowledgments

Terminal.Gui paved the way for serious TUI development in .NET. SharpConsoleUI's own Unix input handling was directly inspired by Terminal.Gui v2's approach to bypassing .NET's Console APIs. Building on the shoulders of the work done by Miguel de Icaza and the Terminal.Gui community is what open source is about.

Real-World Applications

Terminal.Gui powers numerous production tools across the .NET ecosystem.

SharpConsoleUI powers:

  • ServerHub — Linux server monitoring dashboard with 14 real-time widgets
  • LazyNuGet — Terminal-based NuGet package manager
  • LazyDotIDE — Console-based .NET IDE with LSP IntelliSense

Links:

Top comments (0)