Skip to content

Commit 44535f1

Browse files
committed
consult environment variable TREPAN_PYGMENTS_STYLE
in order to get a default value for pygments style
1 parent df4f55c commit 44535f1

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

trepan/lib/default.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright (C) 2008-2009, 2013, 2015, 2017, 2020-2021, 2023-2024
3+
# Copyright (C) 2008-2009, 2013, 2015, 2017, 2020-2021, 2023-2025
44
# Rocky Bernstein <rocky@gnu.org>
55
#
66
# This program is free software: you can redistribute it and/or modify
@@ -26,7 +26,15 @@
2626

2727
width = computed_displaywidth()
2828
is_dark_bg = is_dark_background()
29-
default_style = "zenburn" if is_dark_bg else "tango"
29+
30+
31+
# If TREPAN_PYGMENTS_STYLE has been set, use that as the defalt.
32+
pygments_style_from_environment = os.environ.get("TREPAN_PYGMENTS_STYLE", None)
33+
34+
if pygments_style_from_environment is not None:
35+
default_style = pygments_style_from_environment
36+
else:
37+
default_style = "zenburn" if is_dark_bg else "tango"
3038

3139
# Below are the default debugger settings. The debugger object version
3240
# of this may change. A setting is something a user may want to

trepan/processor/command/set_subcmd/style.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright (C) 2015, 2017-2018, 2020, 2024 Rocky Bernstein
2+
# Copyright (C) 2015, 2017-2018, 2020, 2024-2025 Rocky Bernstein
33
#
44

5+
import os
56
from pygments.styles import STYLE_MAP
67
from trepan.lib.complete import complete_token
78
from trepan.processor.command.base_subcmd import DebuggerSubcommand
@@ -51,6 +52,8 @@ def run(self, args):
5152
return
5253

5354
self.debugger.settings[self.name] = args[0]
55+
# Set an environment variable so subshells pick up this setting.
56+
os.environ["TREPAN_PYGMENTS_STYLE"] = args[0]
5457
return
5558

5659
pass

0 commit comments

Comments
 (0)