Spaces:
Sleeping
Sleeping
fixing dark mode
Browse files
layout.py
CHANGED
|
@@ -33,7 +33,6 @@ def apply_theme():
|
|
| 33 |
}
|
| 34 |
ace_lang = ace_lang_map.get(lang, "python")
|
| 35 |
|
| 36 |
-
# Inject custom theme CSS
|
| 37 |
st.markdown(
|
| 38 |
f"""
|
| 39 |
<style>
|
|
@@ -47,35 +46,37 @@ def apply_theme():
|
|
| 47 |
from {{ opacity: 0; transform: translateY(10px); }}
|
| 48 |
to {{ opacity: 1; transform: translateY(0); }}
|
| 49 |
}}
|
|
|
|
| 50 |
[data-testid="stSidebar"] {{
|
| 51 |
background-color: {colors["panel_bg"]} !important;
|
| 52 |
-
transition: background-color 0.3s ease;
|
| 53 |
}}
|
|
|
|
| 54 |
.ace_editor, .ace_scroller {{
|
| 55 |
background: {colors["panel_bg"]} !important;
|
| 56 |
box-shadow: 0 4px 8px {colors["shadow"]} !important;
|
| 57 |
border-radius: 8px !important;
|
| 58 |
-
transition: background-color 0.3s ease;
|
| 59 |
}}
|
|
|
|
| 60 |
textarea, input, .stTextArea textarea {{
|
| 61 |
background: {colors["panel_bg"]} !important;
|
| 62 |
color: {colors["text"]} !important;
|
| 63 |
border: 1px solid {colors["border"]} !important;
|
| 64 |
border-radius: 4px !important;
|
| 65 |
-
transition: background-color 0.3s ease, color 0.3s ease;
|
| 66 |
}}
|
|
|
|
| 67 |
label, .stTextLabel, .stTextArea label {{
|
| 68 |
color: {colors["text"]} !important;
|
| 69 |
}}
|
|
|
|
| 70 |
button, .stDownloadButton > button {{
|
| 71 |
background-color: {colors["accent"]} !important;
|
| 72 |
color: #fff !important;
|
| 73 |
border-radius: 6px !important;
|
| 74 |
-
transition: background-color 0.3s ease, transform 0.2s ease;
|
| 75 |
}}
|
| 76 |
button:hover {{
|
| 77 |
transform: scale(1.05) !important;
|
| 78 |
}}
|
|
|
|
| 79 |
.chat-container {{
|
| 80 |
background: {colors["panel_bg"]} !important;
|
| 81 |
border: 1px solid {colors["border"]} !important;
|
|
@@ -83,8 +84,8 @@ def apply_theme():
|
|
| 83 |
padding: 1rem;
|
| 84 |
max-height: 480px;
|
| 85 |
overflow-y: auto;
|
| 86 |
-
transition: background-color 0.3s ease;
|
| 87 |
}}
|
|
|
|
| 88 |
.chat-message {{
|
| 89 |
margin-bottom: 1rem;
|
| 90 |
padding: 0.75rem 1rem;
|
|
@@ -98,6 +99,7 @@ def apply_theme():
|
|
| 98 |
background: rgba(200,200,200,0.2);
|
| 99 |
align-self: flex-start;
|
| 100 |
}}
|
|
|
|
| 101 |
pre code {{
|
| 102 |
display: block;
|
| 103 |
padding: 0.5rem;
|
|
@@ -106,24 +108,27 @@ def apply_theme():
|
|
| 106 |
overflow-x: auto;
|
| 107 |
}}
|
| 108 |
|
| 109 |
-
/*
|
| 110 |
-
|
|
|
|
| 111 |
color: {colors["text"]} !important;
|
| 112 |
}}
|
| 113 |
-
|
|
|
|
| 114 |
background-color: {colors["panel_bg"]} !important;
|
| 115 |
color: {colors["text"]} !important;
|
| 116 |
border: 1px solid {colors["border"]} !important;
|
| 117 |
-
border-radius: 6px;
|
| 118 |
-
padding: 0.25rem;
|
| 119 |
}}
|
| 120 |
-
|
|
|
|
| 121 |
background-color: {colors["panel_bg"]} !important;
|
| 122 |
color: {colors["text"]} !important;
|
| 123 |
border: 1px dashed {colors["border"]};
|
| 124 |
border-radius: 8px;
|
| 125 |
}}
|
| 126 |
-
|
|
|
|
| 127 |
background-color: {colors["accent"]} !important;
|
| 128 |
color: white !important;
|
| 129 |
border-radius: 6px;
|
|
|
|
| 33 |
}
|
| 34 |
ace_lang = ace_lang_map.get(lang, "python")
|
| 35 |
|
|
|
|
| 36 |
st.markdown(
|
| 37 |
f"""
|
| 38 |
<style>
|
|
|
|
| 46 |
from {{ opacity: 0; transform: translateY(10px); }}
|
| 47 |
to {{ opacity: 1; transform: translateY(0); }}
|
| 48 |
}}
|
| 49 |
+
|
| 50 |
[data-testid="stSidebar"] {{
|
| 51 |
background-color: {colors["panel_bg"]} !important;
|
|
|
|
| 52 |
}}
|
| 53 |
+
|
| 54 |
.ace_editor, .ace_scroller {{
|
| 55 |
background: {colors["panel_bg"]} !important;
|
| 56 |
box-shadow: 0 4px 8px {colors["shadow"]} !important;
|
| 57 |
border-radius: 8px !important;
|
|
|
|
| 58 |
}}
|
| 59 |
+
|
| 60 |
textarea, input, .stTextArea textarea {{
|
| 61 |
background: {colors["panel_bg"]} !important;
|
| 62 |
color: {colors["text"]} !important;
|
| 63 |
border: 1px solid {colors["border"]} !important;
|
| 64 |
border-radius: 4px !important;
|
|
|
|
| 65 |
}}
|
| 66 |
+
|
| 67 |
label, .stTextLabel, .stTextArea label {{
|
| 68 |
color: {colors["text"]} !important;
|
| 69 |
}}
|
| 70 |
+
|
| 71 |
button, .stDownloadButton > button {{
|
| 72 |
background-color: {colors["accent"]} !important;
|
| 73 |
color: #fff !important;
|
| 74 |
border-radius: 6px !important;
|
|
|
|
| 75 |
}}
|
| 76 |
button:hover {{
|
| 77 |
transform: scale(1.05) !important;
|
| 78 |
}}
|
| 79 |
+
|
| 80 |
.chat-container {{
|
| 81 |
background: {colors["panel_bg"]} !important;
|
| 82 |
border: 1px solid {colors["border"]} !important;
|
|
|
|
| 84 |
padding: 1rem;
|
| 85 |
max-height: 480px;
|
| 86 |
overflow-y: auto;
|
|
|
|
| 87 |
}}
|
| 88 |
+
|
| 89 |
.chat-message {{
|
| 90 |
margin-bottom: 1rem;
|
| 91 |
padding: 0.75rem 1rem;
|
|
|
|
| 99 |
background: rgba(200,200,200,0.2);
|
| 100 |
align-self: flex-start;
|
| 101 |
}}
|
| 102 |
+
|
| 103 |
pre code {{
|
| 104 |
display: block;
|
| 105 |
padding: 0.5rem;
|
|
|
|
| 108 |
overflow-x: auto;
|
| 109 |
}}
|
| 110 |
|
| 111 |
+
/* Fix selectbox and file uploader in dark mode */
|
| 112 |
+
section[data-testid="stSelectbox"] label,
|
| 113 |
+
section[data-testid="stFileUploader"] label {{
|
| 114 |
color: {colors["text"]} !important;
|
| 115 |
}}
|
| 116 |
+
|
| 117 |
+
section[data-testid="stSelectbox"] div[data-baseweb="select"] {{
|
| 118 |
background-color: {colors["panel_bg"]} !important;
|
| 119 |
color: {colors["text"]} !important;
|
| 120 |
border: 1px solid {colors["border"]} !important;
|
| 121 |
+
border-radius: 6px !important;
|
|
|
|
| 122 |
}}
|
| 123 |
+
|
| 124 |
+
section[data-testid="stFileUploader"] .stFileUploaderDropzone {{
|
| 125 |
background-color: {colors["panel_bg"]} !important;
|
| 126 |
color: {colors["text"]} !important;
|
| 127 |
border: 1px dashed {colors["border"]};
|
| 128 |
border-radius: 8px;
|
| 129 |
}}
|
| 130 |
+
|
| 131 |
+
section[data-testid="stFileUploader"] .row-widget.stButton > button {{
|
| 132 |
background-color: {colors["accent"]} !important;
|
| 133 |
color: white !important;
|
| 134 |
border-radius: 6px;
|