4

In SyntaxHighlighter, is it possible to highlight lines with different colors (say, some lines in green, some other in blue)?

Roberto Aloi
  • 30,570
  • 21
  • 75
  • 112

5 Answers5

4

Like @MatTheCat said, change the background-color on the class alt1 and/or alt2

.syntaxhighlighter .line.alt1 {
    background-color: white !important;
}
.syntaxhighlighter .line.alt2 {
   background-color: #F8F8F8 !important;
}
FrankyFred
  • 5,272
  • 1
  • 20
  • 19
1

Each line is a with a class which shows the line number () so apply a background-color to the right class.

MatTheCat
  • 18,071
  • 6
  • 54
  • 69
0

The version 3.0.83 supports highlighting of certain lines. See http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/highlight.html

koppor
  • 19,079
  • 15
  • 119
  • 161
0
<pre class="brush: php; html-script: true; highlight: [1, 2, 3, 4, 5, 6]">
     line 1
     line 2
     line 3
     line 4
     line 5
     line 6
</pre>

this will highlight line 1 to 6. Check Documentation: http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/highlight.html

vijay rami
  • 535
  • 4
  • 19
0

I don't know SyntaxHighlighter, but looking at the site it would appear that you can highlight with a single colour, but there's nothing to allow you to use multiple highlight colours.

The only thing I can suggest is to contact the author and suggest it as a feature request.

Spudley
  • 166,037
  • 39
  • 233
  • 307