ANSITerm 0.5.2
See the version list below for details.
dotnet add package ANSITerm --version 0.5.2
NuGet\Install-Package ANSITerm -Version 0.5.2
<PackageReference Include="ANSITerm" Version="0.5.2" />
paket add ANSITerm --version 0.5.2
#r "nuget: ANSITerm, 0.5.2"
// Install ANSITerm as a Cake Addin #addin nuget:?package=ANSITerm&version=0.5.2 // Install ANSITerm as a Cake Tool #tool nuget:?package=ANSITerm&version=0.5.2
ANSITerm
Cross-platform .NET Standard 2.0 library for working with terminals.
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, alsostty 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 | Versions 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. |
-
- System.Drawing.Common (>= 4.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.