Skip to content

Commit

Permalink
🎨 Make blocks output more visible (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisFederico authored Feb 11, 2022
2 parents 541f358 + 99d9ae1 commit 9fa1502
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions pyflow/blocks/codeblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ def __init__(self, source: str = "", **kwargs):
QPen(QColor("#00ff00")), # Transmitting
]

self.output_panel_background_color = "#1E1E1E"

# Add output pannel
self.output_panel = self.init_output_panel()
self.run_button = self.init_run_button()
Expand All @@ -89,6 +91,10 @@ def init_output_panel(self):
output_panel = QTextEdit()
output_panel.setReadOnly(True)
output_panel.setFont(self.source_editor.font())
style_sheet = (
f'QTextEdit {{ background-color: "{self.output_panel_background_color}"; }}'
)
output_panel.setStyleSheet(style_sheet)
return output_panel

def init_run_button(self):
Expand Down
13 changes: 7 additions & 6 deletions pyflow/blocks/markdownblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ def __init__(self, **kwargs):
self.splitter.addWidget(self.editor)

self.rendered_markdown = QWebEngineView()
self.output_panel_background_color = "#1E1E1E"
self.rendered_markdown.page().setBackgroundColor(
QColor.fromRgba64(0, 0, 0, alpha=0)
QColor(self.output_panel_background_color)
)

self.splitter.addWidget(self.rendered_markdown)
Expand All @@ -58,14 +59,14 @@ def valueChanged(self):
"""Update markdown rendering when the content of the markdown editor changes."""
t = self.editor.text()

dark_theme = """
dark_theme =f'''
<style>
*{
background-color:transparent;
*{{
background-color:"""{self.output_panel_background_color}""";
color:white;
}
}}
</style>
"""
'''

self.rendered_markdown.setHtml(f"{dark_theme}{markdown(t)}")

Expand Down

0 comments on commit 9fa1502

Please sign in to comment.