simplecov-html icon indicating copy to clipboard operation
simplecov-html copied to clipboard

Fix "missed branch" background color

Open cboos opened this issue 5 years ago • 2 comments

First, thanks for the new release, with the new branch coverage support

I noticed that the choice of background color can sometimes be problematic, due to the syntax highlighting of the code. The comments are not supposed to be executed but the syntax highlighting is not perfect and sometimes code is rendered as comment when it's not. If you have a .missed-branch style on that, this becomes unreadable:

image

So I propose this one instead:

image

At the occasion of tweaking the CSS, I noticed that only the .missed-branch:nth-child(odd) was ever used... which lead to a follow-up change, moving the status class from the <li> to its parent <div>.

cboos avatar Apr 13 '20 20:04 cboos

:wave:

Heyo, thanks for your contribution :green_heart: and sorry for not giving it attention earlier :(

I'm a bit confused why the class was moved to the div from the li? :thinking:

Also color choice wise (yayyy bike shedding! ;P ) I'm not sure this is the best... I'll ponder it a bit. It's a change for people but you're absolutely right, readability of what's missed should trump color preferences. Another question would be if we could update the library we're using for the highlighting to detect these cases but well ruby is notoriously hard to highlight well.

Cheerio, Tobi

PragTob avatar Aug 21 '20 07:08 PragTob

I'm a bit confused why the class was moved to the div from the li? 🤔

Well, as I said, this was to get the existing CSS .missed-branch:nth-child(odd)/even working... The <div> elements are the direct "children" of the <ol> element, the <li> are always single child of their <div> hence .missed-branch:nth-child(even) will never apply. Now having said that, I wonder if this <ol><div><li> scheme is even legit HTML... so you probably might want to get rid of the <div> altogether.

Also color choice wise (yayyy bike shedding! ;P ) I'm not sure this is the best... I'll ponder it a bit. It's a change for people but you're absolutely right, readability of what's missed should trump color preferences. Another question would be if we could update the library we're using for the highlighting to detect these cases but well ruby is notoriously hard to highlight well.

You could provide an escape hatch for polyglots ;-) Have a configuration tweak or something that would allow for calling Pygments. Oh, there's even already a gem for doing that in a smart way, pygments.rb.

cboos avatar Aug 28 '20 07:08 cboos