Skip to content

Commit 115e696

Browse files
committed
html-writer: improve colorization of source code ctx
1 parent 6e16197 commit 115e696

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

html-writer.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,20 @@ void HtmlWriter::handleDef(const Defect &def) {
470470
d->str << ": ";
471471
}
472472

473+
static CtxEventDetector detector;
474+
const bool isCtxLine = detector.isAnyCtxLine(evt);
475+
if (isCtxLine) {
476+
const char *color = (detector.isKeyCtxLine(evt))
477+
? "000000"
478+
: "C0C0C0";
479+
d->str << "<span style='color: #" << color << ";'>";
480+
}
481+
473482
d->str << HtmlLib::escapeTextInline(evt.msg);
474483

484+
if (isCtxLine)
485+
d->str << "</span>";
486+
475487
switch (evt.verbosityLevel) {
476488
case 1:
477489
case 2:

0 commit comments

Comments
 (0)