0

I developed a code to show the coverage for specific C, C++ and Python files (Coverage is computed b using GCov). Now I can show the source code using Pygments. I have an array of covered lines and missed lines, I want to change the background of covered lines to green and background of missed lines to red. Is it possible to do that using Pygments?

Iman
  • 473
  • 1
  • 4
  • 20

1 Answers1

1

You can achieve that by subclassing the HTMLFormatter. Out of the box the HTMLFormatter only supports line highlighting, but not in different colors as you need it. See https://pygments.org/docs/formatters/#HtmlFormatter for more details (scroll down to the subclassing part.)

Anteru
  • 19,042
  • 12
  • 77
  • 121