serilog-contrib / serilog-sinks-richtextbox

A Serilog sink that writes log events to a WPF RichTextBox control with colors and theme support
Apache License 2.0
100 stars 25 forks source link

Update README with example of how to create a custom theme #73

Open Suplanus opened 1 year ago

Suplanus commented 1 year ago

I found no way to declare a custom theme base on colored theme. The class ConsoleHtmlColor is set to internal so I can't use it. Any idea, or should I send a PR?

augustoproiete commented 1 year ago

You don't really need ConsoleHtmlColor in order to create a custom theme... Colors are just HTML color code strings. E.g.:

var customTheme = new RichTextBoxConsoleTheme
(
    new Dictionary<RichTextBoxThemeStyle, RichTextBoxConsoleThemeStyle>
    {
        [RichTextBoxThemeStyle.Text] = new RichTextBoxConsoleThemeStyle { Foreground = "#ffffff" },
        [RichTextBoxThemeStyle.SecondaryText] = new RichTextBoxConsoleThemeStyle { Foreground = "#c0c0c0" },
        // etc.
    }
);

That said, if the ConsoleHtmlColor class is useful for creating custom themes, I'd take a PR to make the class public.

Suplanus commented 1 year ago

Ah, great... thanks 💖 So I think its not needed to make it public. I will make an example for white background and take it in the readme as PR.