Serilog.Sinks.RichTextBox.WinForms.Colored
3.2.0
dotnet add package Serilog.Sinks.RichTextBox.WinForms.Colored --version 3.2.0
NuGet\Install-Package Serilog.Sinks.RichTextBox.WinForms.Colored -Version 3.2.0
<PackageReference Include="Serilog.Sinks.RichTextBox.WinForms.Colored" Version="3.2.0" />
<PackageVersion Include="Serilog.Sinks.RichTextBox.WinForms.Colored" Version="3.2.0" />
<PackageReference Include="Serilog.Sinks.RichTextBox.WinForms.Colored" />
paket add Serilog.Sinks.RichTextBox.WinForms.Colored --version 3.2.0
#r "nuget: Serilog.Sinks.RichTextBox.WinForms.Colored, 3.2.0"
#:package Serilog.Sinks.RichTextBox.WinForms.Colored@3.2.0
#addin nuget:?package=Serilog.Sinks.RichTextBox.WinForms.Colored&version=3.2.0
#tool nuget:?package=Serilog.Sinks.RichTextBox.WinForms.Colored&version=3.2.0
Serilog.Sinks.RichTextBox.WinForms.Colored
A Serilog sink that writes log events to a WinForms RichTextBox with support for coloring and custom themes.

Features
- Colored log events in a WinForms RichTextBox control
- Multiple theme presets with customization options
- High-performance asynchronous processing
- Line limit to control memory usage
- Support for pretty-printing of JSON objects
- WCAG compliant color schemes based on the Serilog WPF RichTextBox sink.
Getting Started
Install the package from NuGet:
Install-Package Serilog.Sinks.RichTextBox.WinForms.Colored
Declare your RichTextBox control:
private System.Windows.Forms.RichTextBox richTextBox1;
private void InitializeComponent()
{
this.richTextBox1.BackColor = System.Drawing.SystemColors.Window;
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Font = new System.Drawing.Font("Cascadia Mono", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
}
Configure the logger to use the sink using the RichTextBox extension method:
Log.Logger = new LoggerConfiguration()
.WriteTo.RichTextBox(richTextBox1, theme: ThemePresets.Literate)
.CreateLogger();
Log.Information("Hello, world!");
See the Extension Method for more configuration options.
Configuration Options
| Option | Description | Default Value |
|---|---|---|
theme |
The color theme applied when rendering individual message tokens. | ThemePresets.Literate |
autoScroll |
When true (default) the target control scrolls automatically to the most recent log line. |
true |
maxLogLines |
Maximum number of log events retained in the in-memory circular buffer and rendered in the control. | 256 |
outputTemplate |
Serilog output template that controls textual formatting of each log event. | [{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception} |
formatProvider |
Optional culture-specific or custom formatting provider used when rendering scalar values; null for the invariant culture. |
CultureInfo.InvariantCulture |
prettyPrintJson |
When true, formats JSON values with indentation and line breaks for better readability. |
false |
spacesPerIndent |
Number of spaces per indentation level when pretty printing JSON. | 2 |
Themes
Available built-in themes:
| Theme | Description |
|---|---|
ThemePresets.Literate |
Styled to replicate the default theme of Serilog.Sinks.Console (default) |
ThemePresets.Grayscale |
A theme using only shades of gray, white, and black |
ThemePresets.Colored |
A theme based on the original Serilog.Sinks.ColoredConsole sink |
ThemePresets.Luminous |
A light theme with high contrast for accessibility |
The themes based on the original sinks are slightly adjusted to be WCAG compliant, ensuring that the contrast ratio between text and background colors is at least 4.5:1.
You can create your own custom themes by creating a new instance of the Theme class and passing it to the RichTextBox extension method. Look at the existing themes for examples.
Support the Project 💖
This project has been maintained since 2022 and is still under active development. If you find it useful, please consider supporting it. Your support will help keep the project alive and allow me to dedicate more time to making improvements. You can support it through:
Every contribution of any size helps sustain ongoing development.
Contributing
Contributions are welcome! Report issues, improve documentation, or submit pull requests.
See CONTRIBUTING.md for guidelines.
License
Copyright © 2025 Simon Vonhoff & Contributors - Provided under the Apache License, Version 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows7.0 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0 was computed. 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. net9.0-windows7.0 is compatible. 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. |
| .NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
| .NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 is compatible. net472 was computed. net48 was computed. net481 was computed. |
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Serilog.Sinks.RichTextBox.WinForms.Colored:
| Package | Downloads |
|---|---|
|
Bciflex.Brainstorm.Common
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.0 | 113 | 11/10/2025 |
| 3.1.3 | 5,813 | 7/13/2025 |
| 3.1.2 | 286 | 7/7/2025 |
| 3.1.1 | 218 | 7/3/2025 |
| 3.1.0 | 206 | 6/30/2025 |
| 3.0.1 | 179 | 6/28/2025 |
| 3.0.0 | 217 | 6/21/2025 |
| 2.1.2 | 313 | 6/6/2025 |
| 2.1.0 | 3,326 | 3/17/2025 |
| 2.0.0 | 9,300 | 9/8/2024 |
| 1.2.2 | 5,391 | 4/15/2024 |
| 1.2.1 | 1,266 | 3/30/2024 |
| 1.2.0 | 5,005 | 9/25/2023 |
| 1.1.2 | 10,915 | 10/16/2022 |
| 1.1.1 | 960 | 9/9/2022 |
| 1.1.0 | 1,314 | 6/24/2022 |
| 1.0.2 | 994 | 6/11/2022 |
| 1.0.1 | 1,012 | 5/16/2022 |
| 1.0.0 | 1,016 | 5/9/2022 |
- Added support for JSON pretty-printing in log messages.
See repository for more information:
https://github.com/vonhoff/Serilog.Sinks.RichTextBox.WinForms.Colored