Sharpie-Libs-PdCurses 2025.10.3

dotnet add package Sharpie-Libs-PdCurses --version 2025.10.3
                    
NuGet\Install-Package Sharpie-Libs-PdCurses -Version 2025.10.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="Sharpie-Libs-PdCurses" Version="2025.10.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sharpie-Libs-PdCurses" Version="2025.10.3" />
                    
Directory.Packages.props
<PackageReference Include="Sharpie-Libs-PdCurses" />
                    
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 Sharpie-Libs-PdCurses --version 2025.10.3
                    
#r "nuget: Sharpie-Libs-PdCurses, 2025.10.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.
#:package Sharpie-Libs-PdCurses@2025.10.3
                    
#: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=Sharpie-Libs-PdCurses&version=2025.10.3
                    
Install as a Cake Addin
#tool nuget:?package=Sharpie-Libs-PdCurses&version=2025.10.3
                    
Install as a Cake Tool

Sharpie

Status Coverage NCurses PDCurses PDCursesMod Issues License .NET 9 NuGet Downloads

Sharpie is a terminal manipulation library based on NCurses and targeting .NET 6 (dotnet core) and above.

Demo

Or, if you prefer the Snake game...

Demo

📚 📖 Complete Documentation Available Here 📚

Get started with comprehensive guides, API references, and examples!

Supported platforms

Sharpie supports any platform that .NET 9.0+, ncurses, pdcurses and pdcurses-mod support. This essentially means that Linux, Macos and Windows are supported on both x64 and ARM64 architectures.

For more information on supported platforms visit .NET Supported Platforms Page and NCurses Packages Page.

Sharpie provides unofficial builds for all the supported libraries located in the lib directory

Installation

Install the main library by adding the NuGet package:

dotnet add package Sharpie-Curses

Additionally, one can install packages containing prebuilt native libraries. These packages are useful when targeting platforms that do not bundle a supported curses library by default (e.g. Windows).

dotnet add package Sharpie-Libs-PdCurses
dotnet add package Sharpie-Libs-PdCursesMod
dotnet add package Sharpie-Libs-NCurses

Features

Almost all of Curses functionality is exposed through Sharpie. What follows is a list of supported features:

  1. Terminal allows interfacing with terminal functionality exposed by Curses,
  2. Screen abstracts away the screen handling,
  3. Pad abstracts away the off-screen windows (known as pads),
  4. SubPad and SubWindow carves out areas of their respective parents for easy management,
  5. EventPump allows developers to listen for Curses events such as key presses, mouse moves and resizes,
  6. ColorManager abstracts away the management of colors,
  7. Even SoftLabelKeys are supported (though antiquated),

In addition to wrapping NCurses, this library also adds numerous quality-of-life improvements such as:

  1. Management of overlapping Windows within a Screen,
  2. Proper Window resizing and placement during terminal resizing events,
  3. Automatic Screen refresh management and support for atomic refreshes,
  4. Supports SynchronizationContext-type execution,
  5. Supports protected/synchronized or raw access to all classes,
  6. And other small additions here and there...

Reasons

There are a number of libraries out there that already offer bindings to NCurses. One of the more popular one is Terminal.Gui; and others such as dotnet-curses also exist.

So why another one? The are many reasons, but the most important ones are:

  1. There is no .NET, object-oriented version of NCurses bindings,
  2. Existing versions are old, or are targeting old versions of .NET which do not benefit from numerous advances in the .NET platform,
  3. No other library exposes most of Curses functionality,
  4. Testing is either very limited or completely non-existent.
  5. And finally -- because I wanted to dabble in Curses.

How To

What follows is a small example of how to use the library: Demo


// Create the terminal instance without any non-standard settings.
using var terminal = new Terminal(CursesBackend.Load(), new(ManagedWindows: true));

// Set the main screen attributes for text and drawings.
terminal.Screen.ColorMixture = terminal.Colors.MixColors(StandardColor.Green, StandardColor.Blue);

// Draw a border on the screen.
terminal.Screen.DrawBorder();

// Force a refresh so that all drawings will be actually pushed to teh screen.
terminal.Screen.Refresh();

// Create a child window within the terminal to operate within.
// The other cells contain the border so we don't want to overwrite those.
var subWindow = terminal.Screen.SubWindow(
    new(1, 1, terminal.Screen.Size.Width - 2, terminal.Screen.Size.Height - 2));

// Process all events coming from the terminal.
foreach (var @event in terminal.Events.Listen(subWindow))
{
    // Write the  event that occurred.
    subWindow.WriteText($"{@event}\n");
    
    // If the event is a resize, change the size of the child window
    // to allow for the screen to maintain its border.
    // And then redraw the border of the main screen.
    if (@event is TerminalResizeEvent re)
    {
        subWindow.Size = new(re.Size.Width - 2, re.Size.Height - 2);
        terminal.Screen.DrawBorder();
    }
    
    // If the user pressed CTRL+C, break the loop.
    if (@event is KeyEvent { Key: Key.Character, Char.IsAscii: true, Char.Value: 'C', Modifiers: ModifierKey.Ctrl })
    {
        break;
    }
}

As you can imagine, there are numerous other uses built into the library. Start out by reading Setting Up The Terminal wiki page.

License

[Contributors] [./CONTRIBUTORS.md] BSD 3-Clause License

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
2025.10.3 148 10/4/2025
1.0.4 269 6/26/2025
1.0.3 783 1/10/2023
1.0.2 400 1/10/2023
1.0.0 407 1/10/2023