Quansight-Labs / accessible-pygments

♿ Accessible pygments themes
https://quansight-labs.github.io/accessible-pygments/
BSD 3-Clause "New" or "Revised" License
12 stars 5 forks source link

feature request: support diff highlighting #31

Open drammock opened 11 months ago

drammock commented 11 months ago

Over at Pydata-Sphinx-Theme we've had a user request to support .diff highlighting: https://github.com/pydata/pydata-sphinx-theme/issues/1506

I haven't looked at all the themes in this repo, but I looked at a11y_high_contrast_dark and _light and here is (I think) the problem:

https://github.com/Quansight-Labs/accessible-pygments/blob/58caf8c2441670664fd01697688090fd914bfbfb/a11y_pygments/a11y_high_contrast_dark/style.py#L94-L104

I think what is needed is to define Inserted as Colors.green, change Deleted to Colors.red, and (maybe?) change either Heading or Subheading so they are different from one another. The addition of Inserted probably means that a gi class should get added to the CSS files too (unless those are auto-generated? I don't have much experience with pygments development).

For reference, in Monokai (which has better diff highlighting), Deleted is pink, Inserted is a light-yellowish-green, Subheading is a sort of greenish-light-grey, and Heading is undefined.

https://github.com/pygments/pygments/blob/8f3bec7982ba52915ee95f34f18e188243364600/pygments/styles/monokai.py#L100-L111

trallard commented 11 months ago

Thanks for opening this issue @drammock - I will look into these improvements. But since I am going to be on a few weeks leave this fix might only be available in a month or so.

Carreau commented 5 months ago

I was talking with @trallard and I believe there are a few things we can try/do.

I believe it is possible to highlight not only the diff but the underlying language as well. This raise some questions, how do you handle colors, the way other things handle this is that inserted/removed only change the background of the lines.