ANSITerm 0.5.3

dotnet add package ANSITerm --version 0.5.3
NuGet\Install-Package ANSITerm -Version 0.5.3
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="ANSITerm" Version="0.5.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ANSITerm --version 0.5.3
#r "nuget: ANSITerm, 0.5.3"
#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.
// Install ANSITerm as a Cake Addin
#addin nuget:?package=ANSITerm&version=0.5.3

// Install ANSITerm as a Cake Tool
#tool nuget:?package=ANSITerm&version=0.5.3

ANSITerm

Cross-platform .NET Standard 2.0 library for working with terminals.

API Documentation

Installation

dotnet add package ANSITerm

Features

  • 8, 16, 256-color and true color modes
  • Automatic conversion between colors (nearest RGB)
  • Uses ANSI sequences if supported
  • Supports alternative buffer via tput, emulated on Windows cmd
  • Platform-independent cursor positioning as defined by ANSI
  • Interface is close to System.Console, things that don't work on all supported platforms were removed

Details

Currently there are two backends - StdBackend and ANSIBackend. First one mostly wraps corefx Console class, second one uses ANSI sequences.

Windows

Supported terminals (no configuration):

  • Windows CMD (std) - has maximum of 16 colors
  • ConEmu (ANSI) - true color support is assumed
  • mintty (ANSI) - true color support is assumed

Working terminals needing configuration:

  • MobaXTerm - $LINES and $ROWS environment variables must be set, also stty icanon min 1 is required for retrieving cursor position.

ANSI backend is used if any of these variables is set:

  • CONEMUANSI=ON (set by ConEmu)
  • MSYSCON (set by MSYS2, should contain path to mintty)
  • TERM (set by MobaXTerm)

Linux and OS X

ANSI backend is used. Information about color count, keys and other stuff is grabbed from terminfo using corefx TermInfo.

Example

using ANSITerm;

// ...
var term = ANSIConsole.GetInstance();
term.SetFullscreen(true);
term.SetCursorPosition(10, 10);
term.ForegroundColor = new ColorValue(Color.Lime);
term.WriteLine("Hello, world! Press ENTER to exit.");
term.ReadLine();

Can I replace ncurses with it?

Well, no. It's closer to Python colorama library, but has some additional features. This project is aimed to be a simple and lightweight, and to contain only core functions that should work on all major platforms.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
0.5.3 2,879 4/13/2019
0.5.2 656 3/26/2019
0.5.1 633 3/13/2019
0.5.0 634 3/11/2019
0.5.0-dev 510 3/11/2019