Lists and Calendars
Listing items in your console
Tables and Calendars
This allows you to render a table that consists of rows and columns to the terminal. You can use the cell options variable to configure various cells, such as colors. Calendars internally use the table renderer to render the core elements of a calendar, and they support non-Gregorian calendars.
var Rows = new string[,]
{
{ "Ubuntu Version", "Release Date", "Support End", "ESM Support End" },
{ "12.04 (Precise Pangolin)", new DateTime(2012, 4, 26).ToString(), new DateTime(2017, 4, 28).ToString(), new DateTime(2019, 4, 28).ToString() },
{ "14.04 (Trusty Tahr)", new DateTime(2014, 4, 17).ToString(), new DateTime(2019, 4, 25).ToString(), new DateTime(2024, 4, 25).ToString() },
{ "16.04 (Xenial Xerus)", new DateTime(2016, 4, 21).ToString(), new DateTime(2021, 4, 30).ToString(), new DateTime(2026, 4, 30).ToString() },
{ "18.04 (Bionic Beaver)", new DateTime(2018, 4, 26).ToString(), new DateTime(2023, 4, 30).ToString(), new DateTime(2028, 4, 30).ToString() },
{ "20.04 (Focal Fossa)", new DateTime(2020, 4, 23).ToString(), new DateTime(2025, 4, 25).ToString(), new DateTime(2030, 4, 25).ToString() },
{ "22.04 (Jammy Jellyfish)", new DateTime(2022, 4, 26).ToString(), new DateTime(2027, 4, 25).ToString(), new DateTime(2032, 4, 25).ToString() },
{ "24.04 (Noble Numbat)", new DateTime(2024, 4, 25).ToString(), new DateTime(2029, 4, 25).ToString(), new DateTime(2034, 4, 25).ToString() },
};
var misc = new Table()
{
Rows = Rows,
Header = true,
Left = 4,
Top = 2,
InteriorWidth = ConsoleWrapper.WindowWidth - 7,
InteriorHeight = ConsoleWrapper.WindowHeight - 5,
Settings =
[
new CellOptions(2, 2) { CellColor = ConsoleColors.Red, CellBackgroundColor = ConsoleColors.DarkRed, ColoredCell = true },
new CellOptions(3, 2) { CellColor = ConsoleColors.Red, CellBackgroundColor = ConsoleColors.DarkRed, ColoredCell = true },
new CellOptions(4, 2) { CellColor = ConsoleColors.Red, CellBackgroundColor = ConsoleColors.DarkRed, ColoredCell = true },
new CellOptions(2, 3) { CellColor = ConsoleColors.Red, CellBackgroundColor = ConsoleColors.DarkRed, ColoredCell = true },
new CellOptions(3, 3) { CellColor = ConsoleColors.Red, CellBackgroundColor = ConsoleColors.DarkRed, ColoredCell = true },
new CellOptions(4, 3) { CellColor = ConsoleColors.Red, CellBackgroundColor = ConsoleColors.DarkRed, ColoredCell = true },
new CellOptions(2, 4) { CellColor = ConsoleColors.Yellow, CellBackgroundColor = ConsoleColors.Olive, ColoredCell = true },
new CellOptions(3, 4) { CellColor = ConsoleColors.Yellow, CellBackgroundColor = ConsoleColors.Olive, ColoredCell = true },
new CellOptions(2, 5) { CellColor = ConsoleColors.Yellow, CellBackgroundColor = ConsoleColors.Olive, ColoredCell = true },
new CellOptions(3, 5) { CellColor = ConsoleColors.Yellow, CellBackgroundColor = ConsoleColors.Olive, ColoredCell = true },
]
};
TextWriterRaw.WriteRaw(misc.Render());

ListEntry
and Listing
ListEntry
and Listing
These renderables help you create a rendered list of items easily. Listing
accepts any enumerable with optional functions that convert individual items to string representations, while ListEntry
is used to render a single entry in the key and the value form.
var misc = new Listing()
{
Objects = new string[]
{
"One",
"Two",
"Three",
"Four",
}
};
TextWriterRaw.WriteRaw(misc.Render());

Selection
You can render a list of selection elements using this renderable. This uses a part of the selection style renderer code.
var finalSelections = new InputChoiceInfo[]
{
new("Choice one", "The first choice"),
new("Choice two", "The second choice"),
new("Choice three", "The third choice"),
new("Choice four", "The fourth choice"),
new("Choice five", "The fifth choice"),
new("Choice six", "The sixth choice"),
new("Choice seven", "The seventh choice"),
new("Choice eight", "The eighth choice"),
};
var selections = new Selection(finalSelections)
{
Left = 2,
Top = 1,
CurrentSelection = 2,
Height = 7,
Width = 30,
};
TextWriterRaw.WriteRaw(selections.Render());
