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

Using filter: instead of 2 sets of colors is broken (v0.5.1) #74

Open
daniel-pfeiffer opened this issue Sep 3, 2020 · 1 comment
Open

Comments

@daniel-pfeiffer
Copy link

daniel-pfeiffer commented Sep 3, 2020

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 can cat if you don't want to download & run pl). But if you hover it with your mouse, you see what aha -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> and style. 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 styles with my predefined classes makes it even more compact and readable. Here I didn't need it, but html would allow, e.g. class='red bright-green-bg'.

@theZiz
Copy link
Owner

theZiz commented Oct 4, 2020

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.

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