Lindydancer / e2ansi

Syntax highlighting for `less`, powered by Emacs
87 stars 3 forks source link

Blended colors aren't generated correctly #16

Open kengruven opened 1 week ago

kengruven commented 1 week ago

In Racket programs, for sexp comments, racket-mode does a very clever thing: the code in the sexp comment is highlighted with colors as normal, but then also grayed out.

For example, with my theme, the line (sqrt 4) has the function name in orange, and the number in bright green. The line #;(sqrt 4) has has the function name in dark orange, and the number in dark green. All the other characters are gray.

Currently, e2ansi doesn't do this. Sexp comments are entirely plain gray, which is fine, but not quite the same.

The relevant part of racket-mode seems to be here. I don't know enough about font lock in Emacs (or e2ansi) to know if this would be easy or hard. It would be nice to have, but it's certainly not the most important feature.

Lindydancer commented 6 days ago

Interesting...

When I run e2ansi from inside a GUI emacs, it seems to work. I tried both the default number of colors, 256, and 16.

However, when I run e2ansi in batch mode, it doesn't appear to be working.

I dived into the racket-mode source code and found that it created a number of "faded" faces on the fly, by reading the foreground color of other faces.

Unfortunately, this will not work in a batch environment since faces in noninteractive mode doesn't have colors.

I don't have any good solution for you. The ones that I can think of is:

Come to think of it. It might work (I haven't been able to test it) to define a color theme with the faces in question. I think color themes take precedence over the face basic definition.

kengruven commented 3 hours ago

Yeah, I suspected this was going to be complex. Feel free to close this bug. It's not that important to me.