Answer is yes. Mike Samuel's answer seems to misinterpret or ignore the question.
The "piano keys" striping of code (not line numbers) occurs with every other line of text having an alternating background color whenever line numbers are requested. I wanted to turn it off when showing line numbers, but the original questioner wanted to know how to turn it on (like for an Excel spreadsheet) but without showing line numbers. Neither question, however, would seem to have anything to do with the line numbers or the li
style directly, hence the confusion.
To fix this, a background-color
property can be added; this overrides the striping colors of the numbered prettify commands and allows custom stripes.
An answer to both my problem and the original was eventually found. A style was added to override the current prettify code such as the following. You must still specify linenums
in the prettify
class but none
will be shown:
highlight every 5th line no nums:
<style>
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8
{ background:#000022 !important; list-style-type:none !important}
li.L4,li.L9
{ background:#080833 !important; list-style-type:none !important}
</style>
highlight every 5th line with nums:
<style>
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8
{ background:#000022 !important; list-style-type:decimal !important}
li.L4,li.L9
{ background:#080833 !important; list-style-type:decimal !important}
</style>
Important: there is no comma before the curly bracket. If you insert such
a comma the style will fail!