Skip to content

Commit

Permalink
Merge pull request #4 from hpc-io/theme
Browse files Browse the repository at this point in the history
Include light theme option for export data
  • Loading branch information
jeanbez authored Jan 18, 2023
2 parents 4d40090 + 878f5ce commit 233fb16
Showing 1 changed file with 51 additions and 4 deletions.
55 changes: 51 additions & 4 deletions drishti/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@
from rich.text import Text
from rich.syntax import Syntax
from rich.panel import Panel
from rich.terminal_theme import TerminalTheme
from rich.terminal_theme import MONOKAI
from subprocess import call

from packaging import version


console = Console(record=True)

RECOMMENDATIONS = 0
HIGH = 1
WARN = 2
Expand Down Expand Up @@ -133,6 +132,21 @@
help='Export the report as an SVG image'
)

parser.add_argument(
'--light',
default=False,
action='store_true',
dest='export_theme_light',
help='Use a light theme for the report when generating files'
)

parser.add_argument(
'--size',
default=False,
dest='export_size',
help='Console width used for the report and generated files'
)

parser.add_argument(
'--verbose',
default=False,
Expand Down Expand Up @@ -167,9 +181,14 @@

args = parser.parse_args()

if args.export_size:
console = Console(record=True, width=int(args.export_size))
else:
console = Console(record=True)

csv_report = []


def validate_thresholds():
"""
Validate thresholds defined by the user.
Expand Down Expand Up @@ -1519,18 +1538,46 @@ def main():
)
)

if args.export_theme_light:
export_theme = TerminalTheme(
(255, 255, 255),
(0, 0, 0),
[
(26, 26, 26),
(244, 0, 95),
(152, 224, 36),
(253, 151, 31),
(157, 101, 255),
(244, 0, 95),
(88, 209, 235),
(120, 120, 120),
(98, 94, 76),
],
[
(244, 0, 95),
(152, 224, 36),
(224, 213, 97),
(157, 101, 255),
(244, 0, 95),
(88, 209, 235),
(246, 246, 239),
],
)
else:
export_theme = MONOKAI

if args.export_html:
console.save_html(
'{}.html'.format(args.darshan),
theme=MONOKAI,
theme=export_theme,
clear=False
)

if args.export_svg:
console.save_svg(
'{}.svg'.format(args.darshan),
title='Drishti',
theme=MONOKAI,
theme=export_theme,
clear=False
)

Expand Down

0 comments on commit 233fb16

Please sign in to comment.