ErikForwerk.ConsoleTools.ProgressBar 1.0.3

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

Console Progress Bar

Current Status

Current Repository Status Current Repository Status Codecov Test Coverage WakaTime Tracking NuGet

Table of Contents

Basics

This project provides functions to easily and conveniently display a progress bar in a C# console window when iterating over an enumeration. (similar to tqdm in python)

This is a private project and was mainly done for fun and learning purposes. It is not intended to be used in production code.

using ConsoleProgressBar;

int[] numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

foreach (int number in numbers.ConsoleProgress())
{
	// Do something with the number
}

Styling

There are different predefined styles and color sets that can be used to change the appearance of the progress bar. All default styles can be accessed through the ConsoleProgressStyle class.

foreach (int number in numbers
	.ConsoleProgress()
	.WithStyle(ConsoleProgressStyle.Millennium) )
{
	// Do something with the number
}

Default Styles Example GIF

Of course it is possible to define own custom styles using the ConsoleProgressStyle class.

var customStyle = new ConsoleProgressStyle(true, true, ">>", "<<", '*', '#', FractionsSets.AnimationCircle),

foreach (int number in numbers
	.ConsoleProgress()
	.WithStyle(customStyle) )
{
	// Do something with the number
}

Custom Styles Example GIF

Colors

You can apply different color sets to the progress bar using the .WithColors(…). All default color sets can be accessed through the ConsoleProgressColors class.

foreach (int number in numbers
	.ConsoleProgress()
	.WithColors(ConsoleProgressColors.Red) )
{
	// your code here
}

Default Colors Example GIF

Colors can also be customized using the .WithColor(…) and .WithBgColor(…) extension methods.

foreach (int number in numbers
	.ConsoleProgress()
	.WithColor(ConsoleColor.Blue, ConsoleColor.Cyan, ConsoleColor.DarkGray)
	.WithBgColor(ConsoleColor.Red) )
{
	// your code here
}

Random Examples

The example console application ConsoleExample shows some random combinations of the available styles and colors for the progress bar.

Default Colors Example GIF

Additional Features

When iterating over huge external data (e.g. entity framework table rows) it might be useful to provide the progress bar with the total number of elements to be processed. This can be done by providing the total number of elements with .WithPreCount(…) extension method. This will prevent the progress bar from trying to count the elements itself which all items to be iterated over which in turn will lead to executing the DB query twice.

For debugging it might be useful to cancel the iteration after a certain number of elements. This can be done by providing the maximum number of elements with .CancelAfter(…) extension method.

For testing purposes, there is the extension method .WithDebugMode() which will prevent the progress bar from trying to read the window size and cursor positions which might not work in the testing environment.

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.
  • net9.0

    • No dependencies.

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.3 17 7/18/2025
1.0.2 28 7/18/2025
1.0.1 29 7/18/2025
1.0.0 31 7/18/2025