colorized-logs icon indicating copy to clipboard operation
colorized-logs copied to clipboard

Red, blue, green colors in bold are not shown in bold when converted with ansi2html

Open pacho2 opened this issue 5 years ago • 3 comments

The attached "test" file contains a plain text to be shown in red, blue and green (all in bold). It's properly seen in the terminal, but when ansi2html converts it to html (test.html file), browsers show it in "normal" instead of "bold"

Thanks

test.zip

pacho2 avatar Oct 04 '18 08:10 pacho2

I generated it with the options -n -w, but it's the same without any options

pacho2 avatar Oct 04 '18 08:10 pacho2

I wouldn't call this a bug, but the matter might be somewhat controversial and/or confusing: the code usually named "bold" actually means "bright" on most but not all implementations. This comes from really ancient times: on hardcopy terminals it meant "bold" that even there was not any wider than normal text, merely stronger impressed by having the print head strike twice (and named so only because the engineers strove to emulate non-computer printing, where the name comes from).

I'm away from my big computer today thus it's uncomfortable to test; I looked at a bunch of terminals of which only xterm shows \e[1m using wider lines.

Funnily enough, ansi2html uses <b> that's then disabled via CSS, so non-CSS browsers like lynx or text-to-speech show such text with emphasis instead of color (so blind folks can perceive it).

I'm not sure what to do but I don't think it's a good idea to change the default. You can inject any CSS with --style to redefine the interpretation (uncolored \e[1m uses class "BOLD", green \e[1m uses "HIG" and so on), but doing so for every possible color would be tedious. Perhaps a switch would fit your use case?

kilobyte avatar Oct 04 '18 20:10 kilobyte

The thing that looked also strange to me is that, depending on the colors, it looked to only affect to that plain "red, blue and green" ones... while using more "complex" color variations, it looked to behave as wanted (for me). Look for example to attached new file test2.zip

At least on my browser (now google-chrome), test2.html looks with proper "bold" letters (like it's seen in gnome-terminal for example), while test.html, with "regular" colors, look to me the same as without any bold. I have seen this also changes depending on my using "-n -w" options or not. I use them always (as it fits better for my needs) and I have generated both html files in that way, but I have noticed that if -n is not passed, both are not shown in bold

pacho2 avatar Oct 05 '18 07:10 pacho2