Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default background color for ANSI logs is black instead of default #2873

Closed
sasmith opened this issue Apr 4, 2024 · 4 comments
Closed

Default background color for ANSI logs is black instead of default #2873

sasmith opened this issue Apr 4, 2024 · 4 comments
Assignees

Comments

@sasmith
Copy link

sasmith commented Apr 4, 2024

Describe the bug
The default background color for ANSI logs is black, regardless of whether a user is in light or dark mode. This means that if a user uses ANSI code 49 (to indicate a default background color), they'll get black. This isn't great for light mode.

To Reproduce
Run a docker container that logs the string \x1b[49mHello World. View this log in Dozzle, in light mode. This line will show up with a black background.

Expected behavior
ANSI color code 49 should be some sort of default background.

Screenshots
Screenshot 2024-04-04 at 13 48 01

Desktop (please complete the following information):

  • OS: Mac OS
  • Docker version: 26.0.0
  • Browser & version: Chrome
  • Version: 6.4.2

Proposed fix
This is an issue that Dozzle inherits from ansi-to-html, which has a default background color of black. Changing the initialization of AnsiConvertor in assets/components/LogViewer/SimpleLogItem.vue to something like new AnsiConvertor({ escapeXML: false, fg: "var(--base-content-color)", bg: "initial" }); seems to address the problem.

Here both bg: "initial" and bg: "transparent" work for my purposes. It's possible that setting fg: "initial" would also simplify matters, but fg colors currently seem fine to me.

@amir20
Copy link
Owner

amir20 commented Apr 4, 2024

Nice catch. Can you send PR? Otherwise I'll look tomorrow.

@amir20
Copy link
Owner

amir20 commented Apr 4, 2024

Maybe var(--base-color) would be better.

@amir20
Copy link
Owner

amir20 commented Apr 4, 2024

Try amir20/dozzle:pr-2874.

@amir20 amir20 closed this as completed in 9b641a9 Apr 5, 2024
@sasmith
Copy link
Author

sasmith commented Apr 6, 2024

This looks fixed to me -- thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants