Skip to content

Commit 199b277

Browse files
authored
Merge pull request #138 from sschuhmann/transparent_background
Transparent background for images
2 parents b9dc0be + a7507f4 commit 199b277

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

lib/kernel.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
{content}
5959
</body>"""
6060

61-
IMAGE_PHANTOM = """<body id="helium-image-result" style="background-color:white">
61+
IMAGE_PHANTOM = """<body id="helium-image-result" style="background-color:none">
6262
<style>
63-
.image {{ background-color: white }}
63+
.image {{ background-color: none }}
6464
.closebutton {{ text-decoration: none }}
6565
</style>
6666
<a class=closebutton href=hide>×</a>
@@ -192,7 +192,10 @@ def run(self):
192192
)
193193
elif msg_type == MSG_TYPE_STREAM:
194194
self._kernel._handle_stream(
195-
content["name"], content["text"], region, view,
195+
content["name"],
196+
content["text"],
197+
region,
198+
view,
196199
)
197200

198201
except Empty:
@@ -243,7 +246,12 @@ def _init_receivers(self):
243246
self._stdin_msg_receiver.start()
244247

245248
def __init__(
246-
self, kernel_id, kernel_manager, parent, connection_name=None, logger=None,
249+
self,
250+
kernel_id,
251+
kernel_manager,
252+
parent,
253+
connection_name=None,
254+
logger=None,
247255
):
248256
"""Initialize KernelConnection class.
249257
@@ -362,7 +370,9 @@ def _handle_error(
362370
try:
363371
lines = """\nError: {ename}, {evalue}.
364372
\nTraceback:\n{traceback}""".format(
365-
ename=ename, evalue=evalue, traceback="\n".join(traceback),
373+
ename=ename,
374+
evalue=evalue,
375+
traceback="\n".join(traceback),
366376
)
367377
lines = remove_ansi_escape(lines)
368378
self._write_text_to_view(lines)
@@ -530,7 +540,7 @@ def _write_mime_data_to_view(
530540
height = dimensions[1] * scale_factor
531541

532542
content = (
533-
'<body style="background-color:white">'
543+
'<body style="background-color: none">'
534544
'<img alt="Out" style="width: {width}; height: {height}" src="data:image/png;base64,{data}" />'
535545
+ "</body>"
536546
).format(data=data, width=width, height=height, bgcolor="white")

0 commit comments

Comments
 (0)