Skip to content

Commit 233fb16

Browse files
authored
Merge pull request #4 from hpc-io/theme
Include light theme option for export data
2 parents 4d40090 + 878f5ce commit 233fb16

File tree

1 file changed

+51
-4
lines changed

1 file changed

+51
-4
lines changed

drishti/main.py

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
from rich.text import Text
2222
from rich.syntax import Syntax
2323
from rich.panel import Panel
24+
from rich.terminal_theme import TerminalTheme
2425
from rich.terminal_theme import MONOKAI
2526
from subprocess import call
2627

2728
from packaging import version
2829

2930

30-
console = Console(record=True)
31-
3231
RECOMMENDATIONS = 0
3332
HIGH = 1
3433
WARN = 2
@@ -133,6 +132,21 @@
133132
help='Export the report as an SVG image'
134133
)
135134

135+
parser.add_argument(
136+
'--light',
137+
default=False,
138+
action='store_true',
139+
dest='export_theme_light',
140+
help='Use a light theme for the report when generating files'
141+
)
142+
143+
parser.add_argument(
144+
'--size',
145+
default=False,
146+
dest='export_size',
147+
help='Console width used for the report and generated files'
148+
)
149+
136150
parser.add_argument(
137151
'--verbose',
138152
default=False,
@@ -167,9 +181,14 @@
167181

168182
args = parser.parse_args()
169183

184+
if args.export_size:
185+
console = Console(record=True, width=int(args.export_size))
186+
else:
187+
console = Console(record=True)
170188

171189
csv_report = []
172190

191+
173192
def validate_thresholds():
174193
"""
175194
Validate thresholds defined by the user.
@@ -1519,18 +1538,46 @@ def main():
15191538
)
15201539
)
15211540

1541+
if args.export_theme_light:
1542+
export_theme = TerminalTheme(
1543+
(255, 255, 255),
1544+
(0, 0, 0),
1545+
[
1546+
(26, 26, 26),
1547+
(244, 0, 95),
1548+
(152, 224, 36),
1549+
(253, 151, 31),
1550+
(157, 101, 255),
1551+
(244, 0, 95),
1552+
(88, 209, 235),
1553+
(120, 120, 120),
1554+
(98, 94, 76),
1555+
],
1556+
[
1557+
(244, 0, 95),
1558+
(152, 224, 36),
1559+
(224, 213, 97),
1560+
(157, 101, 255),
1561+
(244, 0, 95),
1562+
(88, 209, 235),
1563+
(246, 246, 239),
1564+
],
1565+
)
1566+
else:
1567+
export_theme = MONOKAI
1568+
15221569
if args.export_html:
15231570
console.save_html(
15241571
'{}.html'.format(args.darshan),
1525-
theme=MONOKAI,
1572+
theme=export_theme,
15261573
clear=False
15271574
)
15281575

15291576
if args.export_svg:
15301577
console.save_svg(
15311578
'{}.svg'.format(args.darshan),
15321579
title='Drishti',
1533-
theme=MONOKAI,
1580+
theme=export_theme,
15341581
clear=False
15351582
)
15361583

0 commit comments

Comments
 (0)