NE.Console 3.0.0

dotnet add package NE.Console --version 3.0.0
                    
NuGet\Install-Package NE.Console -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NE.Console" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NE.Console" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NE.Console" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NE.Console --version 3.0.0
                    
#r "nuget: NE.Console, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NE.Console@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NE.Console&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NE.Console&version=3.0.0
                    
Install as a Cake Tool

NE.Console

A .NET library for terminal output that is meant to be looked at: panels, tables, progress bars, task lists, spinners, interactive prompts, levelled logging and rule-based highlighting — plus a live layout that repaints a whole screen in place.

Targets net10.0. One dependency: NE.Colors, which owns the colour table and everything that maps a colour down to what a terminal can show.

Install

dotnet add package NE.Console

Released to nuget.org.

A first look

using NE.Console.Rendering;
using NE.Console.Rendering.Logging;
using NE.Console.Rendering.Progress;

Panel.Render("NE.Console", ["Progress bars, tasks, spinners, prompts, logs and panels."]);

ConsoleLog.Info("Starting");

using ProgressBar progress = new();
progress.SetTotal(20).SetLabel("Downloading").Start();

for (var i = 0; i < 20; i++)
{
    progress.Advance();
    progress.SetStatusText($"{i + 1} of 20");
}

progress.Complete();

examples/DemoApp.Console walks through everything below; it needs a real terminal:

dotnet run --project examples/DemoApp.Console

What is in it

Namespace What it gives you
Rendering Panel, Table, AnsiStyle, TextColor, Palette, AnsiText width measuring
Rendering.Live ConsoleLayout, DisplayRegion, LogRegion, Columns, SelectionList, KeyLoop
Rendering.Prompts SelectPrompt, MultiSelectPrompt, ConfirmPrompt, TextPrompt, QuestionGroup
Rendering.Progress ProgressBar, Spinner
Rendering.Tasks TaskList, TaskHandle with sub-tasks
Rendering.Highlighting Highlighter with word and regex rules
Rendering.Logging ConsoleLogInfo, Success, Warn, Caution, Error
Rendering.Terminal TerminalCapabilities, ConsoleViewport

Colours come from NE.Colors: TextColor.From(ColorName.Comet) names one, Palette is the shortlist this library paints with, and TextColor.FromConsoleColor asks for one of the terminal's own sixteen instead.

The rendering model

Everything drawn in place is a list of strings, rebuilt from scratch every frame. ConsoleLayout holds regions in order, concatenates their lines into one frame and hands it to a renderer that diffs against the previous frame and rewrites only the lines that changed.

using ConsoleLayout screen = new();

DisplayRegion grid = new();
LogRegion events = new();

screen.UseFullScreen().AddRegion(grid).AddRegion(events).Start();

KeyLoop.Run(screen, key =>
{
    events.Append($"pressed {key.Key}");
    return key.KeyChar is 'q' or 'Q';
});

Two layout modes: the default draws below the cursor and scrolls with the terminal, while UseFullScreen() enters the alternate screen buffer and anchors the frame at the top, leaving the shell's scrollback untouched.

Worth knowing:

  • Width is measured in visible characters. Use AnsiText.VisibleLength, PadRight, Truncate and Fit rather than string.Length — they skip SGR sequences, and anything coloured misaligns without them.
  • A full-screen frame is cut at the bottom without saying so, at ConsoleViewport.Height.
  • A Panel without SetWidth resizes to its content, so a panel sharing a row with something else jumps as that content changes. Pin the width.
  • Console.WriteLine during a live layout is intercepted, erased around and repainted. Writing to the console any other way corrupts the frame.
  • Colour capability is detected once, at first touch of TerminalCapabilities.Current, and lands on one of four modes: true colour, 256 colours, the sixteen slots, or none. NO_COLOR forces the last and FORCE_COLOR paints even where ANSI was not detected. Below true colour a colour is mapped to the nearest palette entry or the nearest slot. Assign TerminalCapabilities.Current to declare a terminal instead of detecting one — which is what a test of anything coloured has to do, because on a build agent output is redirected and detection turns colour off.

Asking questions

Prompts own the keyboard from the call until they return an answer:

SelectPrompt colors = new("Pick a colour:");
colors.AddOption("Red").AddOption("Green").AddOption("Blue").AllowCustomAnswer();

var picked = colors.Ask();

SelectionList is the other shape: a region that draws itself into a frame and moves on arrows, Tab and digits, while the caller keeps the key loop and decides what confirming means. Use it when the list is part of the picture rather than an interruption.

Contributing

This repository is a read-only mirror. Development happens in a private repository and everything here is generated from it, so pull requests are switched off here — anything merged would be erased by the next release.

Issues are open and welcome — bugs, questions and feature requests all belong here.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 108 8/22/2026
2.6.5 101 8/21/2026