@@ -41,6 +41,7 @@ def _init_html(scene, width, height, flex=None):
4141 @media (prefers-color-scheme: dark) {{
4242 #{ id_ } root {{ --webgpu-canvas-bg: #adadad; }}
4343 }}
44+ html[data-theme="dark"] #{ id_ } root {{ --webgpu-canvas-bg: #adadad; }}
4445 </style>
4546 <div id='{ id_ } root'
4647 style="position: relative; width: min({ width } px, 100%); max-width: 100%; overflow: hidden;"
@@ -227,24 +228,23 @@ def _DrawHTMLLazy(scene, width=640, height=600):
227228 lazy_html = f"""
228229 <style>
229230 #{ id_ } root {{ --webgpu-canvas-bg: #ffffff; }}
230- #{ id_ } img_light {{ display: block; }}
231- #{ id_ } img_dark {{ display: none; }}
232231 @media (prefers-color-scheme: dark) {{
233232 #{ id_ } root {{ --webgpu-canvas-bg: #adadad; }}
234- #{ id_ } img_light {{ display: none; }}
235- #{ id_ } img_dark {{ display: block; }}
236233 }}
234+ html[data-theme="dark"] #{ id_ } root {{ --webgpu-canvas-bg: #adadad; }}
237235 </style>
238236 <div id='{ id_ } root'
239237 style="position: relative; width: min({ width } px, 100%); max-width: 100%; overflow: hidden;"
240238 >
241239 <img id='{ id_ } img_light'
240+ class='only-light dark-light'
242241 src='{ screenshot_light_url } '
243242 style='width: 100%; max-width: 100%; height: auto; aspect-ratio: { width } / { height } ; display: block;'
244243 />
245244 <img id='{ id_ } img_dark'
245+ class='only-dark dark-light'
246246 src='{ screenshot_dark_url } '
247- style='width: 100%; max-width: 100%; height: auto; aspect-ratio: { width } / { height } ; display: none ;'
247+ style='width: 100%; max-width: 100%; height: auto; aspect-ratio: { width } / { height } ; display: block ;'
248248 />
249249 <div id='{ id_ } overlay'
250250 style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;
0 commit comments