Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -197,44 +197,67 @@ st.sidebar.toggle("λ°°κ²½ μ΄λ―Έμ§ μ¬μ©", key="bg_on", value=False)
|
|
| 197 |
if not st.session_state.get("bg_on"):
|
| 198 |
st.sidebar.color_picker("λ¨μ λ°°κ²½", value=st.session_state.get("bg_color", "#F1F1F1"), key="bg_color")
|
| 199 |
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
|
|
|
| 203 |
st.markdown("""
|
| 204 |
<style>
|
|
|
|
| 205 |
.stApp::before, .block-container::before { content: none !important; }
|
| 206 |
-
|
| 207 |
-
.block-container, [data-testid="stSidebar"] { position: relative; z-index: 1; }
|
| 208 |
-
/* μ
λ ₯λ°μ€ νλ¨ μ¬λ°± */
|
| 209 |
div[data-testid="stTextInput"] { margin-bottom: 18px !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
</style>
|
| 211 |
""", unsafe_allow_html=True)
|
| 212 |
|
| 213 |
if st.session_state.get("bg_on"):
|
| 214 |
-
#
|
| 215 |
st.markdown(f"""
|
| 216 |
<style>
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
/* overlay(ν°μ 85% ν¬λͺ
) + μ€μ μ΄λ―Έμ§ */
|
| 223 |
background-image:
|
| 224 |
linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
|
| 225 |
-
url('{BG_URL}');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
}}
|
| 227 |
-
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
}}
|
| 230 |
</style>
|
| 231 |
""", unsafe_allow_html=True)
|
| 232 |
else:
|
| 233 |
-
#
|
| 234 |
color = st.session_state.get("bg_color", "#F1F1F1")
|
| 235 |
st.markdown(f"""
|
| 236 |
<style>
|
| 237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
background-image: none !important;
|
| 239 |
background-color: {color} !important;
|
| 240 |
}}
|
|
@@ -242,7 +265,7 @@ def apply_background():
|
|
| 242 |
""", unsafe_allow_html=True)
|
| 243 |
|
| 244 |
# νΈμΆ
|
| 245 |
-
|
| 246 |
|
| 247 |
# ββ P κΈκΌ΄ ν¬κΈ° 14 px βββββββββββββββββββββββββββββββββββ
|
| 248 |
st.markdown("""
|
|
|
|
| 197 |
if not st.session_state.get("bg_on"):
|
| 198 |
st.sidebar.color_picker("λ¨μ λ°°κ²½", value=st.session_state.get("bg_color", "#F1F1F1"), key="bg_color")
|
| 199 |
|
| 200 |
+
|
| 201 |
+
# === μ€μ 컨ν
μ΄λ(λ³Έλ¬Έ)μλ§ λ°°κ²½ μ μ© ===
|
| 202 |
+
def apply_background_center_only():
|
| 203 |
+
# λ² μ΄μ€ 리μ
: μ 체 λ°°κ²½ μ κ±° + κΈ°λ³Έ μ¬λ°±/λ μ΄μ΄ μ 리
|
| 204 |
st.markdown("""
|
| 205 |
<style>
|
| 206 |
+
.stApp { background: none !important; }
|
| 207 |
.stApp::before, .block-container::before { content: none !important; }
|
| 208 |
+
[data-testid="stSidebar"] { position: relative; z-index: 1; }
|
|
|
|
|
|
|
| 209 |
div[data-testid="stTextInput"] { margin-bottom: 18px !important; }
|
| 210 |
+
|
| 211 |
+
/* μ€μ 컨ν
μ΄λ(.main)λ§ νκ² β λ²μ μ°¨μ΄ ν¬κ΄ */
|
| 212 |
+
:is(
|
| 213 |
+
[data-testid="stAppViewContainer"] > .main,
|
| 214 |
+
section.main,
|
| 215 |
+
main[data-testid="stMain"]
|
| 216 |
+
){
|
| 217 |
+
position: relative;
|
| 218 |
+
isolation: isolate;
|
| 219 |
+
min-height: 100vh; /* νλ©΄ κ°λ μ±μ λ°°κ²½ 곡백 λ°©μ§ */
|
| 220 |
+
}
|
| 221 |
</style>
|
| 222 |
""", unsafe_allow_html=True)
|
| 223 |
|
| 224 |
if st.session_state.get("bg_on"):
|
| 225 |
+
# μ΄λ―Έμ§ λ°°κ²½(μ€μ 컨ν
μ΄λμλ§ μ μ©)
|
| 226 |
st.markdown(f"""
|
| 227 |
<style>
|
| 228 |
+
:is(
|
| 229 |
+
[data-testid="stAppViewContainer"] > .main,
|
| 230 |
+
section.main,
|
| 231 |
+
main[data-testid="stMain"]
|
| 232 |
+
){{
|
|
|
|
| 233 |
background-image:
|
| 234 |
linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
|
| 235 |
+
url('{BG_URL}') !important;
|
| 236 |
+
background-position: center 45% !important;
|
| 237 |
+
background-size: cover !important;
|
| 238 |
+
background-repeat: no-repeat !important;
|
| 239 |
+
background-attachment: scroll, fixed !important;
|
| 240 |
}}
|
| 241 |
+
|
| 242 |
+
@media (max-width: 768px){{
|
| 243 |
+
:is(
|
| 244 |
+
[data-testid="stAppViewContainer"] > .main,
|
| 245 |
+
section.main,
|
| 246 |
+
main[data-testid="stMain"]
|
| 247 |
+
){{ background-attachment: scroll, scroll !important; }}
|
| 248 |
}}
|
| 249 |
</style>
|
| 250 |
""", unsafe_allow_html=True)
|
| 251 |
else:
|
| 252 |
+
# λ¨μ λ°°κ²½(μ€μ 컨ν
μ΄λμλ§ μ μ©)
|
| 253 |
color = st.session_state.get("bg_color", "#F1F1F1")
|
| 254 |
st.markdown(f"""
|
| 255 |
<style>
|
| 256 |
+
:is(
|
| 257 |
+
[data-testid="stAppViewContainer"] > .main,
|
| 258 |
+
section.main,
|
| 259 |
+
main[data-testid="stMain"]
|
| 260 |
+
){{
|
| 261 |
background-image: none !important;
|
| 262 |
background-color: {color} !important;
|
| 263 |
}}
|
|
|
|
| 265 |
""", unsafe_allow_html=True)
|
| 266 |
|
| 267 |
# νΈμΆ
|
| 268 |
+
apply_background_center_only()
|
| 269 |
|
| 270 |
# ββ P κΈκΌ΄ ν¬κΈ° 14 px βββββββββββββββββββββββββββββββββββ
|
| 271 |
st.markdown("""
|