Sina1138 commited on
Commit ·
db8e2b5
1
Parent(s): 2979714
Implement dark mode theme overrides to match light mode appearance in Demo.py
Browse files- interface/Demo.py +12 -1
interface/Demo.py
CHANGED
|
@@ -1683,10 +1683,21 @@ html, body, .gradio-container, main, .contain { scroll-behavior: smooth !importa
|
|
| 1683 |
@keyframes agrslide { 0% { width:15%; margin-left:0; } 50% { width:35%; margin-left:50%; } 100% { width:15%; margin-left:85%; } }
|
| 1684 |
"""
|
| 1685 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1686 |
with gr.Blocks(
|
| 1687 |
title="ReView",
|
| 1688 |
css=CUSTOM_CSS,
|
| 1689 |
-
theme=
|
| 1690 |
js="""() => {
|
| 1691 |
var btn = document.createElement('button');
|
| 1692 |
btn.id = 'back-to-top-btn';
|
|
|
|
| 1683 |
@keyframes agrslide { 0% { width:15%; margin-left:0; } 50% { width:35%; margin-left:50%; } 100% { width:15%; margin-left:85%; } }
|
| 1684 |
"""
|
| 1685 |
|
| 1686 |
+
# Build a theme where dark mode looks identical to light mode
|
| 1687 |
+
_theme = gr.themes.Default()
|
| 1688 |
+
_dark_overrides = {}
|
| 1689 |
+
for _attr in dir(_theme):
|
| 1690 |
+
if _attr.endswith('_dark') and not _attr.startswith('_'):
|
| 1691 |
+
_light_attr = _attr[:-5]
|
| 1692 |
+
_light_val = getattr(_theme, _light_attr, None)
|
| 1693 |
+
if _light_val is not None:
|
| 1694 |
+
_dark_overrides[_attr] = _light_val
|
| 1695 |
+
_theme.set(**_dark_overrides)
|
| 1696 |
+
|
| 1697 |
with gr.Blocks(
|
| 1698 |
title="ReView",
|
| 1699 |
css=CUSTOM_CSS,
|
| 1700 |
+
theme=_theme,
|
| 1701 |
js="""() => {
|
| 1702 |
var btn = document.createElement('button');
|
| 1703 |
btn.id = 'back-to-top-btn';
|