GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bytecode-api/BytecodeApi.ConsoleUI at master · bytecode77/bytecode-api

Expand file tree

/

BytecodeApi.ConsoleUI

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

BytecodeApi.ConsoleUI

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
.nuget
.nuget
 
 
Properties
Properties
 
 
BytecodeApi.ConsoleUI.csproj
BytecodeApi.ConsoleUI.csproj
 
 
ConsoleInput.cs
ConsoleInput.cs
 
 
ConsoleInputTheme.cs
ConsoleInputTheme.cs
 
 
ConsoleStyle.cs
ConsoleStyle.cs
 
 
ConsoleWriter.cs
ConsoleWriter.cs
 
 
ConsoleWriterTheme.cs
ConsoleWriterTheme.cs
 
 
README.md
README.md
 
 

README.md

Outline

BytecodeApi.ConsoleUI

Console input & output library.

Examples

BytecodeApi.ConsoleUI

ConsoleWriter

The ConsoleWriter is a class that writes formatted text to the Console.

ConsoleWriter.WriteLine("Welcome to my interactive command line tool!");

ConsoleWriter.Success("Config loaded");
ConsoleWriter.Warning("Minimum screen resolution of 320x240 not met");
ConsoleWriter.Error("Windows NT 4.0 is not supported");

Output:

Welcome to my interactive command line tool!
20:19:11 [+] Config loaded
20:19:11 [!] Minimum screen resolution of 320x240 not met
20:19:11 [-] Windows NT 4.0 is not supported

ConsoleWriter.Preview

The Preview method displays a message that is erased from the console, after a successive write.

This helps to declutter console output, by erasing progress messages and only leaving success/failure messages on the screen.

ConsoleWriter.Preview("Loading file");
// Load file here
ConsoleWriter.Success("File loaded");

Output:

File loaded

(The initial message "Loading file" was erased)

To display a progress bar and erase it when done, use the Preview method with additional progress parameters:

for (int i = 0; i < 100; i++)
{
	ConsoleWriter.Preview("Loading file", i, $"Progress: {i} %");
	Thread.Sleep(10);
}

ConsoleWriter.Success("File loaded");

Output:

20:22:19 ... Loading file
64 % [████████████████████░░░░░░░░]

ConsoleInput.Text

Write a question and input a string:

string name = ConsoleInput.Text("What's your name?");
ConsoleInput.Confirmation

Write a question and request a y or n from the user:

bool confirmed = ConsoleInput.Confirmation("Do you want to delete the file?");

Output:

Do you want to delete the file? [y/n]

If the defaultChoice parameter is true, [Y/n] is displayed (upper case Y). Pressing return confirms the question positively.

Likewise, false shows a [y/N] and pressing return confirms the question negatively.

ConsoleInput.Select

To prompt for a selection, use the Select method.

int selection = ConsoleInput.Select(
	"Place your order, sir",
	"Pork",
	"Beef",
	"Veggie");

// selection == 1    -> Pork
// selection == 2    -> Beef
// selection == 3    -> Veggie

Output:

Place your order, sir
  [1] Pork
  [2] Beef
  [3] Veggie
Select: _

ConsoleWriterTheme & ConsoleInputTheme

Change the ConsoleWriter.Theme property to configure Console output:

ConsoleWriter.Theme.ErrorStyle = new ConsoleStyle(ConsoleColor.Red, ConsoleColor.Black);
ConsoleWriter.Theme.SuccessIcon = "[+]";
ConsoleWriter.Theme.ErrorIcon = "[-]";

Change the ConsoleInput.Theme property to configure Console input:

ConsoleInput.Theme.ConfirmationAnswerNo = "n";
ConsoleInput.Theme.ConfirmationAnswerYes = "y";
ConsoleInput.Theme.SelectOptionsPromptText = "Select:";

Changelog

5.0.0 (15.02.2026)

  • change: Targeting .NET 10.0

4.0.0 (15.09.2025)

  • change: Targeting .NET 9.0

3.0.1 (10.12.2023)

  • new: ConsoleWriter.WriteLine method overload with no parameters
  • new: ConsoleWriterTheme.TextStyle, PreviewStyle and SuccessStyle properties
  • removed: ConsoleWriterTheme.DefaultStyle property

3.0.0 (08.09.2023)

  • Initial release
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.