Skip to content

Commit 76fbc65

Browse files
Added swap-light-and-dark-colors option (requires latest prompt_toolkit master).
1 parent 0dc5b48 commit 76fbc65

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

pymux/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from prompt_toolkit.layout.layout import Layout
1515
from prompt_toolkit.layout.screen import Size
1616
from prompt_toolkit.output.defaults import create_output
17+
from prompt_toolkit.styles import ConditionalStyleTransformation, SwapLightAndDarkStyleTransformation
1718

1819
from .arrangement import Arrangement, Pane, Window
1920
from .commands.commands import handle_command, call_command_handler
@@ -152,6 +153,10 @@ def on_focus_changed():
152153
mouse_support=Condition(lambda: pymux.enable_mouse_support),
153154
full_screen=True,
154155
style=self.pymux.style,
156+
style_transformation=ConditionalStyleTransformation(
157+
SwapLightAndDarkStyleTransformation(),
158+
Condition(lambda: self.pymux.swap_dark_and_light),
159+
),
155160
on_invalidate=(lambda _: pymux.invalidate()))
156161

157162
# Synchronize the Vi state with the CLI object.
@@ -260,6 +265,7 @@ def __init__(self, source_file=None, startup_command=None):
260265
self.session_name = '0'
261266
self.status_justify = Justify.LEFT
262267
self.default_shell = get_default_shell()
268+
self.swap_dark_and_light = False
263269

264270
self.options = ALL_OPTIONS
265271
self.window_options = ALL_WINDOW_OPTIONS

pymux/options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def set_value(self, pymux, value):
193193
'status-justify': JustifyOption('status_justify'),
194194
'status-interval': PositiveIntOption(
195195
'status_interval', [1, 2, 4, 8, 16, 30, 60]),
196+
197+
# Prompt-toolkit/pymux specific.
198+
'swap-light-and-dark-colors': OnOffOption('swap_dark_and_light'),
196199
}
197200

198201

0 commit comments

Comments
 (0)