SpectreConsoleLibrary2025 1.0.2

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

About

Provides various methods for Spectre.Console listed below.

🔸 If pills may need to use SpectreConsoleHelpers.SetEncoding(); at start of a project to ensure proper UTF-8 encoding.

  • Uses NET 9.0
  • Spectre.Console library version 0.54.0

Pills

Method Name Description
ExitPrompt Shows a “press any key to exit” prompt and waits for user input.
InfoPill Displays an informational (blue) pill with specified alignment and optional text.
ErrorPill Displays an error (red) pill with specified alignment and optional text.
ErrorPill Displays an error pill alongside an exception message for detailed error output.
SuccessPill Displays a success (green) pill with specified alignment and optional text.
WarningPill Displays a warning (yellow) pill with specified alignment and optional text.
WindowTitle Renders a centered, styled window title using a Spectre.Console info pill.

User Interaction

Method Signature Description
ExitPrompt(Justify alignment = Justify.Center) Displays a “press any key to exit” prompt and blocks until input.

Console Configuration

Method Signature Description
SetEncoding() Sets console input/output encoding to UTF-8 without a BOM.

ExceptionSettings Style

Method Signature Description
ExceptionSettingsStyle Defines styles used with AnsiConsole.WriteException

Diagnostics & Caller Info

Method Signature Description
PrintCyan(string? methodName = null) Prints the calling method name in cyan using CallerMemberName.
PrintPink(string? filePath = null, string? methodName = null) Prints project, file, and method name using pink/yellow formatting.

Spectre.Console Markup Utilities

Method Signature Description
ConsoleEscape(this string sender) Escapes Spectre.Console markup characters in a string.
ConsoleRemove(this string sender) Removes Spectre.Console markup from a string.
PanelDisplay(string content, string title = "", Justify alignment = Justify.Center) Displays content within a styled Spectre.Console panel with title and alignment.

JSON Utilities

Method Signature Description
WriteJson(string json) Writes a JSON string to the console with common syntax highlighting.

Project aliases

Alias Description
SCH Defines a global using directive that creates an alias for the class SpectreConsoleHelpers within the namespace SpectreConsoleLibrary2025 which allows easier access to its methods.

💡 Add the following to your project file (.csproj) to enable the alias:

<ItemGroup>
    <Using Include="SpectreConsoleLibrary2025.SpectreConsoleHelpers" Alias="SCH" />
</ItemGroup>
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
1.0.2 243 1/2/2026
1.0.1 140 1/1/2026
1.0.0 164 12/26/2025

Added ExceptionSettingsStyle and updated documentation along with how to create a project alias to this package.