Colors and Styles and Reusability - Spectre Console Series
Spectre Console is a powerful NuGet package for .NET that allows developers to transform plain console applications into visually rich experiences. By combining Spectre Console colors, text decorations, and reusable styles, you can elevate ordinary console output into something informative and polished.
In his video “Colors and Styles and Reusability – Spectre Console Series,” Tim Corey walks through exactly how to do this. In this article, we’ll step through the same points Tim makes, pointing out the time stamps so you can watch along. This is a great way to understand how to create and customize colors, a style class, and even a new style for repeated use.
Introduction to Spectre Console Formatting
At 0:00, Tim explains that Spectre Console “allows you to turn your console apps into visually appealing, informative applications.” He notes this series breaks the library into small chunks so developers can focus on one feature at a time.
He points out the source code link in the description and invites users to subscribe to his channel. This lesson focuses on how to set and return formatted text in the console output and how to make those formats reusable across your program.
Using Inline Markup and MarkupLine
At 0:36, Tim starts by demonstrating AnsiConsole.MarkupLine and AnsiConsole.Markup. These methods give you the ability to embed colors and decorations directly into your string representation.
As Tim explains at 0:51, Markup doesn’t automatically insert a new line, while MarkupLine does—“It’s kind of like Console.Write versus WriteLine.” This difference matters when you want to display multiple items or a list on separate lines.
He types [red]This is the inline markup[/] and runs it to show a red string. Then, at 1:38, he demonstrates foreground and background colors—“Red on White”—so the user can see red text on a white background. By 2:05, he adds bold as a decoration.
Tim notes at 2:18 that inline markup is quick and easy for small actions, but “it’s not really great for all the rest” when you want more structured or reusable styling across functions.

Creating a Preset Style Class
At 2:32, Tim shows how to create a new instance of a style class for reuse. He writes:
var dangerStyle = new Style(
foreground: Color.Red,
background: Color.White,
decoration: Decoration.Bold);var dangerStyle = new Style(
foreground: Color.Red,
background: Color.White,
decoration: Decoration.Bold);Here Tim is assigning a variable called dangerStyle that contains a new style with red foreground, white background, and bold decoration. He also notes at 3:26 you don’t have to fill every argument—you can pick just foreground or just decoration depending on what you need.
This class–based approach gives you the ability to update your styling in one place and apply it consistently wherever you render text, instead of repeating markup tags.
Applying Styles with New Markup
At 3:48, Tim shows how to apply that style. Because AnsiConsole.WriteLine doesn’t accept styles directly, you have to use AnsiConsole.Write with a new markup object:
AnsiConsole.Write(
new Markup("Danger text from style", dangerStyle));AnsiConsole.Write(
new Markup("Danger text from style", dangerStyle));At 4:08, he explains that WriteLine takes only string or simple types, but Write has an overload that accepts an IRenderable object. That’s why you pass your style to new markup and then write it.
Tim remarks at 4:45 that this syntax is “a bit more work,” but it’s the official way to display styled text. He even suggests creating your own method to simplify it if you’re doing this a lot.

Handling Line Breaks and Cursor Placement
After running the code, Tim points out at 5:44 that the cursor sits on the same line as the styled text. That’s because Write doesn’t append a new line. At 6:07, he shows how to fix this by adding \n inside the string, which moves the cursor down.
This little trick ensures your output matches your expectation—important when building larger console applications where user input or data comes after a styled prompt.
Adding Multiple Decorations
Tim next demonstrates combining decorations. At 6:27, he says, “What if you want to apply more than one decoration? For example, I want to apply italics too.” You do this by using a single pipe character to separate decorations.
He shows you can choose from a long list of decorations—bold, italics, strike-through, underline, dim, invert, blink—and even mentions Windows PowerShell and Windows Terminal support at 7:05. As of now, slow blink and rapid blink look the same in Windows Terminal.
By 7:29, he runs the code again and shows italic styling applied in addition to bold. “You can mix and match these how you want,” Tim says at 7:49, creating styles you can apply repeatedly.
This is a powerful feature when you want to highlight errors in red, success messages in green, warnings in yellow, or custom labels in blue, purple, orchid, or even maroon—Spectre Console supports the full RGB color set.
Mixing Inline and Preset Styles
At 8:02, Tim demonstrates how to combine writes and writes with different styles. You can call AnsiConsole.Write multiple times—first with your styled text, then with unstyled or differently styled text—to highlight just part of a line. He shows:
AnsiConsole.Write(new Markup("Danger text", dangerStyle));
AnsiConsole.WriteLine(" and more");AnsiConsole.Write(new Markup("Danger text", dangerStyle));
AnsiConsole.WriteLine(" and more");As Tim explains at 8:37, this is why Write is used rather than WriteLine: you may want to highlight only part of your text before returning to a normal style.

This function gives you a flexible way to build a composite output—maybe a table of data, a progress bar for long-running work, or a panel with multiple columns—and apply styles to only certain items or labels.
Wrapping Up – Your Options
By 9:01, Tim summarizes the options:
Use inline styling with [color]text[/] and Markup or MarkupLine for quick formatting.
- Or create a new style with new Style() and apply it to Markup objects when you call AnsiConsole.Write.
Tim encourages viewers to “try them out with different colors and backgrounds and decorations and all the rest” at 9:26. That includes making new tables with styled headers, adding a progress bar that updates as you process files or arrays of items, or even converting JSON data into a styled display.
He closes at 9:33 by thanking viewers and reminding them he’s Tim Corey. This series is based on the Spectre Console library created by Patrik Svensson with contributions from developers like Phil Scott, and Tim’s videos help you master its features quickly.
Conclusion
Tim Corey’s video clearly shows how Spectre Console takes ordinary console apps and makes them visually engaging. From inline markup to fully reusable style classes, he walks step by step through how to control foreground and background colors, text decorations, and cursor placement.
If you follow along with Tim’s examples at the time stamps above, you’ll be able to add professional-looking styles to your own console apps in no time—without guessing at the syntax. And once you know how to assign variables, add decorations, and render styled text, you can easily extend those skills to build tables, panels, progress bars, and other features that Spectre Console offers.
As Tim says, “Try them out… and see what you like.”
