Closed JasonLandbridge closed 1 year ago
Thanks for the heads-up! This looks nice - though since it can be layered on top of the console sink, it seems like a good candidate to release as a separate package. Have you thought about how it would look as e.g. Serilog.Sinks.Console.ThemeBuilder or something along those lines?
Thanks, yeah that might be a good idea! I will turn it into a separate package :+1:
Awesome! Please do drop us a line when it's out there :-)
Hi there👋
So after diving in the code and doing some research, I figured out that
AnsiConsoleTheme
can essentially support 24-bit RGB color and log formatting (think italics, bold, underline, etc). :tada:See this interesting ANSI Escape Sequences article about color codes and text formatting
So I played around with it and created a system where an
AnsiConsoleTheme
can be created with 24-bit RGB color and log formatting, completely with a Fluent API.Screenshot taken in Jetbrains Rider with UI in dark mode:
It works really well, if I say so myself.
The above essentially boils down to the following:
Which outputs an Ansi string that can set a foreground, background and text format.
All the above is currently part of my own project PlexRipper but a sneak peak can be viewed here in the config folder
The following text formats work after a bit of testing, maybe I can have all working after a bit more testing:
I'm currently on the latest Serilog.Sinks.Console 4.1.0 and would be more than happy to create a PR to have this merged!
Thanks!