sharkdp / hexyl

A command-line hex viewer
Apache License 2.0
9.07k stars 227 forks source link

Bad background color on rxvt-unicode #9

Closed garywill closed 5 years ago

garywill commented 5 years ago

Hi there, Thank you for this tool.

There is a background color making it difficult to see the characters on rxvt-unicode only.

rxvt-unicode with default settings: urxvt

maybe that looks not a big problem, but when I have dark terminal theme, that make it difficult to see: urxvt-black

That background color not appear on other terminals, just rxvt-unicode.

sharkdp commented 5 years ago

There shouldn't be any background colors in the output. It seems like your terminal emulator does not support truecolor ANSI color codes (24-bit) and is mistakenly displaying background colors.

sharkdp commented 5 years ago

It should be fairly easy for hexyl to just use 8-bit ANSI codes. We should work on this.

kilobyte commented 5 years ago

Just checked: rxvt-unicode supports 30-37 (basic ANSI, plus optional bold=bright), 90-97 (aixterm bright), 38;5;0-255 (256-color) but not 38;2;0-255;0-255;0-255 (24-bit).

But then, you don't need any colors above the basic 16, so even 30-37 + 1 should be enough.

sharkdp commented 5 years ago

Hm, yes. We could also go to a basic 16 color scheme, but that would require the user to have a decent color scheme in the terminal :smile:

I think I'd go with interpolated 8-bit colors.

kilobyte commented 5 years ago

The only remaining terminal I know that doesn't understand anything but 16 colors in Hurd console — but it's not like Hurd sees any real use. Anything else at least does something useful (like, Linux and FreeBSD text consoles gracefully degrade 256 to 16, for compatibility with legacy hardware limitations). I obviously exclude unmaintained software, and terminals I haven't looked at.

As for 24-bit, here's a nice table documenting support. TL;DR: the vast majority of maintained terminals support that in current versions, but in too many cases this support is recent. Thus, going with 8-bit sounds right. You can revisit the decision in several years from now.

mooyoul commented 5 years ago

It would be great if hexyl supports 256 colors also 👍 I cannot get beautiful results from hexyl since i'm using Terminal.app (macOS built-in app) with tmux, which does not support 24bit true colors.

Please refer below screenshots:

Terminal.app without tmux

2019-01-10 7 42 52

Terminal.app with tmux

2019-01-10 7 43 10
sharkdp commented 5 years ago

Fixed in v0.3.1.

mooyoul commented 5 years ago

Awesome. how beautiful it is! ❤️ Kudos for your amazing work!

v0.3.1 in Terminal.app with tmux:

2019-01-10 5 39 35
garywill commented 5 years ago

hmmmm.... color not right in rxvt-unicode, v0.3.1

image my environment variables: (if it helps)

COLORTERM=rxvt-xpm
COLORFGBG=default;default
TERM=rxvt-unicode
sharkdp commented 5 years ago

rxvt-unicode, v0.3.1

That can't be right. The current version (from 2016!) is v9.22. v0.3.1 doesn't even seem to be published.

Can you run basic ANSI color tests like this: https://gist.github.com/ketan/2866a236596636311d64 ?

garywill commented 5 years ago

I mean hexyl 0.3.1. Sorry I wans't clear.

I found two rxvt binaries urxvt-256color and urxvt in system. I used urxvt. The 256 color one seems OK.

This is the urxvt test result:

image

image

kilobyte commented 5 years ago

Isn't that the ancient mainline branch of rxvt, with last upstream update in 2001 then a beta in 2003? It lingered until last year in Debian-based distributions. If so, then no wonders it's crap.

sharkdp commented 5 years ago

@garywill I didn't quite understand if you managed to solve the issue or not. If you believe that there is something wrong with hexyl, please open a new ticket.

garywill commented 5 years ago

solved by using the 256 color urxvt, sorry to bother