Open daniel-pfeiffer opened 4 years ago
Thanks for your table, it made it easy to look into possible solutions. For now unfortunately I can just say: With the CSS I know (not a lot) I can't solve this problem with the filter approach. I would need to define 16 instead of 8 colors for foreground and background and that would break a lot. Furthermore I would not be able to use this approach in the 8 and 24 bit mode. However I am stating in code that the behavior is not correct, maybe I should also state this in the man-page.
Your filter can't distinguish between foreground and background colors. So you can't render bright fg with normal bg or vice-versa.
With my Perl One Liner
pl
I give an example for generating a table of all combinations and the numbers that create them. If you run that command snippet in a terminal, you get this output ansi-table.txt (which you cancat
if you don't want to download & runpl
). But if you hover it with your mouse, you see whataha -n
makes of it: In the "fg;" column you still see the contrast between color-pairs. But in all following columns, with a bg-color added, they become the same.On a lesser note, you create a rather redundant amount of
<span>
andstyle
. E.g. in the above example, the fg stays the same for the rest of the line. So you could set it once in an outer<span>
.Similarly this alternates between red & green several times. You can see that I have adapted your output. I put the 1st color into an outer
<span>
and nest the other color, saving quite a bit of html.Thirdly, in this last example you also see how replacing the
style
s with my predefinedclass
es makes it even more compact and readable. Here I didn't need it, but html would allow, e.g.class='red bright-green-bg'
.