serilog-sinks-console icon indicating copy to clipboard operation
serilog-sinks-console copied to clipboard

add Dracula Theme

Open joesdu opened this issue 1 year ago • 4 comments

Add Dracula Theme

joesdu avatar Feb 26 '24 14:02 joesdu

Hi Joe! I should clarify, sorry - I meant some screenshots in the PR description, not in the repository itself. My apologies for the confusion.

nblumhardt avatar Feb 27 '24 07:02 nblumhardt

Hi Joe! I should clarify, sorry - I meant some screenshots in the PR description, not in the repository itself. My apologies for the confusion.

image

joesdu avatar Feb 27 '24 07:02 joesdu

Thanks for the updates. The colors in the theme look like a mix from different versions of the palette - is it possible to use only one of the sets, e.g. just the ANSI-256 version?

image

Modelling the theme on the VSCode one, or another text + data theme, might be useful. For readability, the main text content should probably be in the whitish shade that they've used there.

nblumhardt avatar Feb 29 '24 03:02 nblumhardt

It has been adjusted as much as possible to match the color values of the Dracula Theme.

image

joesdu avatar Feb 29 '24 09:02 joesdu

Hi @joesdu, thanks for all of the effort.

The theme still appears to have some contrast issues; I noticed that Dracula uses the white-ish shade for foreground text, and the unreadable gray is "comment"; I wonder if the output would be more readable if the messages were rendered in the white, and the cyan shade used for stack trace continuation lines?

(This might still leave green for INF?)

nblumhardt avatar Mar 18 '24 01:03 nblumhardt

Hi @joesdu, thanks for all of the effort.

The theme still appears to have some contrast issues; I noticed that Dracula uses the white-ish shade for foreground text, and the unreadable gray is "comment"; I wonder if the output would be more readable if the messages were rendered in the white, and the cyan shade used for stack trace continuation lines?

(This might still leave green for INF?)

Yes, there are problems when it's not a dark theme.

joesdu avatar Mar 18 '24 05:03 joesdu

Sad to see this closed @joesdu; it's definitely not my department but these problems do seem surmountable? Ultimately Nick is just asking these questions from the point of view of getting a truly workable implementation on the first try - getting obvious tweaking done in one shot rather than as a series of chaser releases...

bartelink avatar Mar 18 '24 07:03 bartelink

Sad to see this closed @joesdu; it's definitely not my department but these problems do seem surmountable? Ultimately Nick is just asking these questions from the point of view of getting a truly workable implementation on the first try - getting obvious tweaking done in one shot rather than as a series of chaser releases...

Dracula Theme does not seem to have an example of a light theme. I checked the theme configurations of Windows Terminal and Notepad++, and it only contains dark themes, so it may not be applicable to the light theme version. So I closed this PR, if it is used If you have a dark theme and need to customize the theme color, you can use the following code to achieve it.

builder.Host.UseSerilog((hbc, lc) =>
{
    const LogEventLevel logLevel = LogEventLevel.Information;
    lc.ReadFrom.Configuration(hbc.Configuration)
      .MinimumLevel.Override("Microsoft", logLevel)
      .MinimumLevel.Override("System", logLevel)
      .Enrich.FromLogContext()
      .WriteTo.Async(wt =>
      {
          if (hbc.HostingEnvironment.IsDevelopment())
          {
              //wt.SpectreConsole();
              wt.Debug();
          }
          wt.Console(theme: new AnsiConsoleTheme(new Dictionary<ConsoleThemeStyle, string>
          {
              [ConsoleThemeStyle.Text] = "\x1b[38;5;151m",
              [ConsoleThemeStyle.SecondaryText] = "\x1b[38;5;245m",
              [ConsoleThemeStyle.TertiaryText] = "\x1b[38;5;244m",
              [ConsoleThemeStyle.Invalid] = "\x1b[38;5;214m",
              [ConsoleThemeStyle.Null] = "\x1b[38;5;248m",
              [ConsoleThemeStyle.Name] = "\x1b[38;5;141m",
              [ConsoleThemeStyle.String] = "\x1b[38;5;168m",
              [ConsoleThemeStyle.Number] = "\x1b[38;5;141m",
              [ConsoleThemeStyle.Boolean] = "\x1b[38;5;248m",
              [ConsoleThemeStyle.Scalar] = "\x1b[38;5;119m",
              [ConsoleThemeStyle.LevelVerbose] = "\x1b[37m",
              [ConsoleThemeStyle.LevelDebug] = "\x1b[37m",
              [ConsoleThemeStyle.LevelInformation] = "\x1b[37;1m",
              [ConsoleThemeStyle.LevelWarning] = "\x1b[38;5;208m",
              [ConsoleThemeStyle.LevelError] = "\x1b[38;5;197m\x1b[48;5;238m",
              [ConsoleThemeStyle.LevelFatal] = "\x1b[38;5;197m\x1b[48;5;238m"
          }));
      });
});

joesdu avatar Mar 18 '24 10:03 joesdu