Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -199,56 +199,78 @@ if not st.session_state.get("bg_on"):
|
|
| 199 |
|
| 200 |
# === ์ค์ ์ปจํ
์ด๋์๋ง ๋ฐฐ๊ฒฝ ์ ์ฉ ===
|
| 201 |
def apply_background_center_only():
|
| 202 |
-
# ๋ฒ ์ด์ค ๋ฆฌ์
: ์ฑ ์ ์ฒด ๋ฐฐ๊ฒฝ ์ ๊ฑฐ + ๊ธฐ๋ณธ ๋ ์ด์์ ์ ๋ฆฌ
|
| 203 |
st.markdown("""
|
| 204 |
<style>
|
| 205 |
-
|
|
|
|
| 206 |
.stApp::before, .block-container::before { content: none !important; }
|
| 207 |
-
[data-testid="stSidebar"] { position: relative; z-index: 1; }
|
| 208 |
|
| 209 |
-
/* ์ค์ ์ปจํ
์ด๋
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
position: relative;
|
| 212 |
isolation: isolate;
|
| 213 |
-
overflow: hidden;
|
| 214 |
-
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
}
|
| 216 |
|
| 217 |
-
/* ์
๋ ฅ๋ฐ์ค ํ๋จ ์ฌ๋ฐฑ
|
| 218 |
-
div[data-testid="stTextInput"]
|
| 219 |
</style>
|
| 220 |
""", unsafe_allow_html=True)
|
| 221 |
|
|
|
|
| 222 |
if st.session_state.get("bg_on"):
|
| 223 |
-
# ์ด๋ฏธ์ง ๋ฐฐ๊ฒฝ: ์ค์ ์ปจํ
์ด๋์๋ง ์ ์ฉ
|
| 224 |
st.markdown(f"""
|
| 225 |
<style>
|
| 226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
background-image:
|
| 228 |
linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
|
| 229 |
-
url('{BG_URL}');
|
| 230 |
-
background-position: center 45%;
|
| 231 |
-
background-size: cover;
|
| 232 |
-
background-repeat: no-repeat;
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
background-attachment: scroll, fixed;
|
| 236 |
}}
|
| 237 |
|
| 238 |
-
/* ๋ชจ๋ฐ์ผ์์ fixed
|
| 239 |
-
@media (max-width: 768px)
|
| 240 |
-
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
}}
|
| 243 |
}}
|
| 244 |
</style>
|
| 245 |
""", unsafe_allow_html=True)
|
| 246 |
else:
|
| 247 |
-
# ๋จ์ ๋ฐฐ๊ฒฝ: ์ค์ ์ปจํ
์ด๋์๋ง ์์ ์ ์ฉ
|
| 248 |
color = st.session_state.get("bg_color", "#F1F1F1")
|
| 249 |
st.markdown(f"""
|
| 250 |
<style>
|
| 251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
background-image: none !important;
|
| 253 |
background-color: {color} !important;
|
| 254 |
}}
|
|
|
|
| 199 |
|
| 200 |
# === ์ค์ ์ปจํ
์ด๋์๋ง ๋ฐฐ๊ฒฝ ์ ์ฉ ===
|
| 201 |
def apply_background_center_only():
|
|
|
|
| 202 |
st.markdown("""
|
| 203 |
<style>
|
| 204 |
+
/* 0) ์ฑ ์ ์ฒด ๋ฐฐ๊ฒฝ ์ ๊ฑฐ (์ฌ์ด๋๋ฐ ์ ์ธ) */
|
| 205 |
+
.stApp { background: none !important; }
|
| 206 |
.stApp::before, .block-container::before { content: none !important; }
|
|
|
|
| 207 |
|
| 208 |
+
/* 1) ์ค์ ์ปจํ
์ด๋(๋ฒ์ ๋ณ ๋ชจ๋ ์ผ์ด์ค ํฌ๊ด) */
|
| 209 |
+
/* - ์ต์ /๊ตฌ๋ฒ์ DOM์ ๋ชจ๋ ์ปค๋ฒํ๋๋ก :is()์ data-testid๋ฅผ ๋ณํ */
|
| 210 |
+
:is(
|
| 211 |
+
[data-testid="stAppViewContainer"] [data-testid="block-container"],
|
| 212 |
+
[data-testid="stAppViewContainer"] > .main .block-container,
|
| 213 |
+
section.main > div.block-container,
|
| 214 |
+
div[data-testid="block-container"]
|
| 215 |
+
){
|
| 216 |
position: relative;
|
| 217 |
isolation: isolate;
|
| 218 |
+
overflow: hidden;
|
| 219 |
+
min-height: 100vh; /* ์ ์ฒด ํ๋ฉด ์ฑ์ */
|
| 220 |
+
/* ํ์ ์: border-radius: 12px; */
|
| 221 |
+
/* ๋ชจ๋ฐ์ผ/GPU ๊ฐ์ ํํธ */
|
| 222 |
+
transform: translateZ(0);
|
| 223 |
+
will-change: background-position, background-image;
|
| 224 |
}
|
| 225 |
|
| 226 |
+
/* 2) ์
๋ ฅ๋ฐ์ค ํ๋จ ์ฌ๋ฐฑ */
|
| 227 |
+
div[data-testid="stTextInput"]{ margin-bottom: 18px !important; }
|
| 228 |
</style>
|
| 229 |
""", unsafe_allow_html=True)
|
| 230 |
|
| 231 |
+
# 3) ์ด๋ฏธ์ง/๋จ์ ๋ถ๊ธฐ
|
| 232 |
if st.session_state.get("bg_on"):
|
|
|
|
| 233 |
st.markdown(f"""
|
| 234 |
<style>
|
| 235 |
+
:is(
|
| 236 |
+
[data-testid="stAppViewContainer"] [data-testid="block-container"],
|
| 237 |
+
[data-testid="stAppViewContainer"] > .main .block-container,
|
| 238 |
+
section.main > div.block-container,
|
| 239 |
+
div[data-testid="block-container"]
|
| 240 |
+
){{
|
| 241 |
background-image:
|
| 242 |
linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.85)),
|
| 243 |
+
url('{BG_URL}') !important;
|
| 244 |
+
background-position: center 45% !important;
|
| 245 |
+
background-size: cover !important;
|
| 246 |
+
background-repeat: no-repeat !important;
|
| 247 |
+
/* ์ค๋ฒ๋ ์ด๋ ์คํฌ๋กค, ์ด๋ฏธ์ง๋ ๊ณ ์ (ํจ๋ด๋์ค๊ฐ ์ซ์ผ๋ฉด fixedโscroll) */
|
| 248 |
+
background-attachment: scroll, fixed !important;
|
|
|
|
| 249 |
}}
|
| 250 |
|
| 251 |
+
/* ๋ชจ๋ฐ์ผ์์ fixed ๋ฌธ์ ํํผ */
|
| 252 |
+
@media (max-width: 768px){{
|
| 253 |
+
:is(
|
| 254 |
+
[data-testid="stAppViewContainer"] [data-testid="block-container"],
|
| 255 |
+
[data-testid="stAppViewContainer"] > .main .block-container,
|
| 256 |
+
section.main > div.block-container,
|
| 257 |
+
div[data-testid="block-container"]
|
| 258 |
+
){{
|
| 259 |
+
background-attachment: scroll, scroll !important;
|
| 260 |
}}
|
| 261 |
}}
|
| 262 |
</style>
|
| 263 |
""", unsafe_allow_html=True)
|
| 264 |
else:
|
|
|
|
| 265 |
color = st.session_state.get("bg_color", "#F1F1F1")
|
| 266 |
st.markdown(f"""
|
| 267 |
<style>
|
| 268 |
+
:is(
|
| 269 |
+
[data-testid="stAppViewContainer"] [data-testid="block-container"],
|
| 270 |
+
[data-testid="stAppViewContainer"] > .main .block-container,
|
| 271 |
+
section.main > div.block-container,
|
| 272 |
+
div[data-testid="block-container"]
|
| 273 |
+
){{
|
| 274 |
background-image: none !important;
|
| 275 |
background-color: {color} !important;
|
| 276 |
}}
|