Skip to content

Commit

Permalink
Add switch case and flag for color blindness
Browse files Browse the repository at this point in the history
  • Loading branch information
DiFerMa committed Sep 11, 2024
1 parent 96c92fc commit fcbc668
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lobster/tools/core/html_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def write_item_box_end(doc):
doc.add_line('<!-- end item -->')


def write_html(fd, report, dot):
def write_html(fd, report, dot, color_blind):
assert isinstance(report, Report)

doc = htmldoc.Document(
Expand Down Expand Up @@ -286,13 +286,13 @@ def write_html(fd, report, dot):
"padding-left" : "0.2em",
}
doc.style[".item-ok"] = {
"background-color" : "#b2e1b2",
"background-color" : "#b2e1b2" if color_blind else "#efe",
}
doc.style[".item-partial"] = {
"background-color" : "#ffe",
}
doc.style[".item-missing"] = {
"background-color" : "#ffb2ff",
"background-color" : "#ffb2ff" if color_blind else "#fee",
}
doc.style[".item-justified"] = {
"background-color" : "#eee",
Expand Down Expand Up @@ -465,6 +465,9 @@ def main():
help="path to dot utility (https://graphviz.org), \
by default expected in PATH",
default=None)
ap.add_argument("--color_blind",
action="store_true",
help="Enable color blind mode")
options = ap.parse_args()

if not os.path.isfile(options.lobster_report):
Expand All @@ -479,7 +482,8 @@ def main():
with open(options.out, "w", encoding="UTF-8") as fd:
write_html(fd = fd,
report = report,
dot = options.dot)
dot = options.dot,
color_blind = options.color_blind)
print("LOBSTER HTML report written to %s" % options.out)


Expand Down

0 comments on commit fcbc668

Please sign in to comment.