Update app.py
Browse files
app.py
CHANGED
|
@@ -21,11 +21,11 @@ THEME: Dict[str, Any] = {
|
|
| 21 |
"pill_pad_h": 14, # px
|
| 22 |
"pill_font": 16, # px
|
| 23 |
"tagline_font": 15, # px
|
| 24 |
-
# Premium header palette
|
| 25 |
-
"bg1": "#
|
| 26 |
-
"bg2": "#
|
| 27 |
-
"text": "#
|
| 28 |
-
"tagline_color": "#
|
| 29 |
},
|
| 30 |
"page": {
|
| 31 |
"top_padding": 50, # px top padding for page
|
|
@@ -56,7 +56,7 @@ THEME: Dict[str, Any] = {
|
|
| 56 |
},
|
| 57 |
"icon": {
|
| 58 |
"diam": 118, # px outer circle
|
| 59 |
-
"img": 106, # px image
|
| 60 |
"circle_bg": "#F1F5F9",
|
| 61 |
"circle_border": "rgba(12,18,32,0.10)",
|
| 62 |
},
|
|
@@ -73,7 +73,6 @@ THEME: Dict[str, Any] = {
|
|
| 73 |
}
|
| 74 |
|
| 75 |
# ========= CARDS (content + per-card overrides) =========
|
| 76 |
-
# Solid, very-light tints for a premium feel (no washed-out rgba)
|
| 77 |
CARDS = [
|
| 78 |
{
|
| 79 |
"title": " ST_GeoMEch_UCS",
|
|
@@ -81,7 +80,7 @@ CARDS = [
|
|
| 81 |
"url": "https://smart-thinking-ucs.hf.space/",
|
| 82 |
"icon": ASSETS / "UCS_logo.png",
|
| 83 |
"style": {
|
| 84 |
-
"bg_top": "#EAF7F1",
|
| 85 |
"bg_bot": "#F6FBF8",
|
| 86 |
"border": "#0F3D3E",
|
| 87 |
},
|
|
@@ -92,7 +91,7 @@ CARDS = [
|
|
| 92 |
"url": "https://smart-thinking-ym.hf.space",
|
| 93 |
"icon": ASSETS / "Ym_logo.png",
|
| 94 |
"style": {
|
| 95 |
-
"bg_top": "#EAF7FD",
|
| 96 |
"bg_bot": "#F5FBFF",
|
| 97 |
"border": "#0E4A6E",
|
| 98 |
},
|
|
@@ -103,7 +102,7 @@ CARDS = [
|
|
| 103 |
"url": "https://smart-thinking-smw.hf.space",
|
| 104 |
"icon": ASSETS / "SMW_logo.png",
|
| 105 |
"style": {
|
| 106 |
-
"bg_top": "#EEF0FF",
|
| 107 |
"bg_bot": "#F7F8FF",
|
| 108 |
"border": "#3E4EB8",
|
| 109 |
},
|
|
@@ -245,7 +244,6 @@ st.markdown(f"""
|
|
| 245 |
padding: var(--c-pv, var(--card-pv)) var(--c-ph, var(--card-ph));
|
| 246 |
background: linear-gradient(180deg, var(--c-bg-top, {card["bg_top"]}) 0%, var(--c-bg-bot, {card["bg_bot"]}) 100%);
|
| 247 |
border: var(--c-bw, var(--card-bw)) solid var(--c-border, var(--cardStroke));
|
| 248 |
-
/* Softer inner highlights → color shows more, keeps 3D */
|
| 249 |
box-shadow:
|
| 250 |
0 14px 32px rgba(2,20,35,.12),
|
| 251 |
0 1px 0 rgba(255,255,255,0.70) inset,
|
|
@@ -258,11 +256,12 @@ st.markdown(f"""
|
|
| 258 |
border-color: var(--cardStrokeHover);
|
| 259 |
box-shadow:
|
| 260 |
0 22px 56px rgba(2,20,35,.18),
|
| 261 |
-
0 1px 0 rgba(255,255,255
|
| 262 |
-
0 -1px 10px rgba(255,255,255
|
| 263 |
filter: saturate(1.03);
|
| 264 |
}}
|
| 265 |
|
|
|
|
| 266 |
.icon-wrap {{
|
| 267 |
width: var(--c-icon-d, {icon["diam"]}px); height: var(--c-icon-d, {icon["diam"]}px);
|
| 268 |
border-radius: 9999px; display:grid; place-items:center;
|
|
@@ -271,8 +270,16 @@ st.markdown(f"""
|
|
| 271 |
box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 10px 22px rgba(2,20,35,.07);
|
| 272 |
}}
|
| 273 |
.icon-wrap img {{
|
| 274 |
-
|
| 275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
}}
|
| 277 |
|
| 278 |
.card h3 {{
|
|
@@ -320,6 +327,14 @@ st.markdown(
|
|
| 320 |
)
|
| 321 |
|
| 322 |
# ========= Hero =========
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
hero_html = img_tag(THEME["hero"]["logo"], "ST_GeoMech SUITE")
|
| 324 |
st.markdown(f"<div class='hero'>{hero_html}</div>", unsafe_allow_html=True)
|
| 325 |
|
|
@@ -331,24 +346,24 @@ def build_card_vars(style: Dict[str, Any]) -> str:
|
|
| 331 |
if "pad_v" in style: s.append(f"--c-pv:{int(style['pad_v'])}px")
|
| 332 |
if "pad_h" in style: s.append(f"--c-ph:{int(style['pad_h'])}px")
|
| 333 |
if "bg_top" in style: s.append(f"--c-bg-top:{style['bg_top']}")
|
| 334 |
-
if "bg_bot" in style: s.append(f"--c-bg-bot:{style['bg_bot
|
| 335 |
-
if "border" in style: s.append(f"--c-border:{style['border
|
| 336 |
if "border_width" in style: s.append(f"--c-bw:{int(style['border_width'])}px")
|
| 337 |
-
if "title_color" in style: s.append(f"--c-title-color:{style['title_color
|
| 338 |
if "title_fs" in style: s.append(f"--c-title-fs:{int(style['title_fs'])}px")
|
| 339 |
-
if "blurb_color" in style: s.append(f"--c-blurb-color:{style['blurb_color
|
| 340 |
if "blurb_fs" in style: s.append(f"--c-blurb-fs:{int(style['blurb_fs'])}px")
|
| 341 |
-
if "btn_bg1" in style: s.append(f"--c-btn-bg1:{style['btn_bg1
|
| 342 |
-
if "btn_bg2" in style: s.append(f"--c-btn-bg2:{style['btn_bg2
|
| 343 |
-
if "btn_text" in style: s.append(f"--c-btn-text:{style['btn_text
|
| 344 |
-
if "btn_border" in style: s.append(f"--c-btn-border:{style['btn_border
|
| 345 |
if "btn_fs" in style: s.append(f"--c-btn-fs:{int(style['btn_fs'])}px")
|
| 346 |
-
if "btn_pad_v" in style: s.append(f"--c-btn-pv:{int(style['btn_pad_v
|
| 347 |
-
if "btn_pad_h" in style: s.append(f"--c-btn-ph:{int(style['btn_pad_h
|
| 348 |
-
if "icon_diam" in style: s.append(f"--c-icon-d:{int(style['icon_diam
|
| 349 |
-
if "icon_img" in style: s.append(f"--c-icon-img:{int(style['icon_img
|
| 350 |
-
if "icon_bg" in style: s.append(f"--c-icon-bg:{style['icon_bg
|
| 351 |
-
if "icon_border" in style: s.append(f"--c-icon-border:{style['icon_border
|
| 352 |
return "; ".join(s)
|
| 353 |
|
| 354 |
def app_card(card_cfg: Dict[str, Any]) -> str:
|
|
|
|
| 21 |
"pill_pad_h": 14, # px
|
| 22 |
"pill_font": 16, # px
|
| 23 |
"tagline_font": 15, # px
|
| 24 |
+
# Premium header palette — DARK GREEN with contrasting text
|
| 25 |
+
"bg1": "#064E3B", # dark green
|
| 26 |
+
"bg2": "#065F46", # deeper green
|
| 27 |
+
"text": "#FFFFFF", # high-contrast pill text
|
| 28 |
+
"tagline_color": "#E2E8F0", # soft-contrast tagline
|
| 29 |
},
|
| 30 |
"page": {
|
| 31 |
"top_padding": 50, # px top padding for page
|
|
|
|
| 56 |
},
|
| 57 |
"icon": {
|
| 58 |
"diam": 118, # px outer circle
|
| 59 |
+
"img": 106, # px image box (will be padded)
|
| 60 |
"circle_bg": "#F1F5F9",
|
| 61 |
"circle_border": "rgba(12,18,32,0.10)",
|
| 62 |
},
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
# ========= CARDS (content + per-card overrides) =========
|
|
|
|
| 76 |
CARDS = [
|
| 77 |
{
|
| 78 |
"title": " ST_GeoMEch_UCS",
|
|
|
|
| 80 |
"url": "https://smart-thinking-ucs.hf.space/",
|
| 81 |
"icon": ASSETS / "UCS_logo.png",
|
| 82 |
"style": {
|
| 83 |
+
"bg_top": "#EAF7F1",
|
| 84 |
"bg_bot": "#F6FBF8",
|
| 85 |
"border": "#0F3D3E",
|
| 86 |
},
|
|
|
|
| 91 |
"url": "https://smart-thinking-ym.hf.space",
|
| 92 |
"icon": ASSETS / "Ym_logo.png",
|
| 93 |
"style": {
|
| 94 |
+
"bg_top": "#EAF7FD",
|
| 95 |
"bg_bot": "#F5FBFF",
|
| 96 |
"border": "#0E4A6E",
|
| 97 |
},
|
|
|
|
| 102 |
"url": "https://smart-thinking-smw.hf.space",
|
| 103 |
"icon": ASSETS / "SMW_logo.png",
|
| 104 |
"style": {
|
| 105 |
+
"bg_top": "#EEF0FF",
|
| 106 |
"bg_bot": "#F7F8FF",
|
| 107 |
"border": "#3E4EB8",
|
| 108 |
},
|
|
|
|
| 244 |
padding: var(--c-pv, var(--card-pv)) var(--c-ph, var(--card-ph));
|
| 245 |
background: linear-gradient(180deg, var(--c-bg-top, {card["bg_top"]}) 0%, var(--c-bg-bot, {card["bg_bot"]}) 100%);
|
| 246 |
border: var(--c-bw, var(--card-bw)) solid var(--c-border, var(--cardStroke));
|
|
|
|
| 247 |
box-shadow:
|
| 248 |
0 14px 32px rgba(2,20,35,.12),
|
| 249 |
0 1px 0 rgba(255,255,255,0.70) inset,
|
|
|
|
| 256 |
border-color: var(--cardStrokeHover);
|
| 257 |
box-shadow:
|
| 258 |
0 22px 56px rgba(2,20,35,.18),
|
| 259 |
+
0 1px 0 rgba(255,255,255,.82) inset,
|
| 260 |
+
0 -1px 10px rgba(255,255,255,.28) inset;
|
| 261 |
filter: saturate(1.03);
|
| 262 |
}}
|
| 263 |
|
| 264 |
+
/* ===== ICON / LOGO — self-contained, not trimmed ===== */
|
| 265 |
.icon-wrap {{
|
| 266 |
width: var(--c-icon-d, {icon["diam"]}px); height: var(--c-icon-d, {icon["diam"]}px);
|
| 267 |
border-radius: 9999px; display:grid; place-items:center;
|
|
|
|
| 270 |
box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 10px 22px rgba(2,20,35,.07);
|
| 271 |
}}
|
| 272 |
.icon-wrap img {{
|
| 273 |
+
/* Keep logos fully visible inside the circle */
|
| 274 |
+
width: calc(var(--c-icon-img, {icon["img"]}px) - 12px);
|
| 275 |
+
height: calc(var(--c-icon-img, {icon["img"]}px) - 12px);
|
| 276 |
+
padding: 6px; /* breathing room */
|
| 277 |
+
box-sizing: border-box;
|
| 278 |
+
object-fit: contain; /* never crop */
|
| 279 |
+
background: #FFFFFF; /* clean canvas for mixed logos */
|
| 280 |
+
border: 2px solid var(--c-border, var(--cardStroke)); /* same as card border */
|
| 281 |
+
border-radius: 14px; /* rounded square inside circle */
|
| 282 |
+
display:block;
|
| 283 |
}}
|
| 284 |
|
| 285 |
.card h3 {{
|
|
|
|
| 327 |
)
|
| 328 |
|
| 329 |
# ========= Hero =========
|
| 330 |
+
def img_tag(path: Path, alt: str, cls: str = "", style: str = "") -> str:
|
| 331 |
+
uri = data_uri(path)
|
| 332 |
+
if not uri:
|
| 333 |
+
return ""
|
| 334 |
+
cls_attr = f' class="{cls}"' if cls else ""
|
| 335 |
+
style_attr = f' style="{style}"' if style else ""
|
| 336 |
+
return f'<img{cls_attr}{style_attr} src="{uri}" alt="{escape(alt)}" />'
|
| 337 |
+
|
| 338 |
hero_html = img_tag(THEME["hero"]["logo"], "ST_GeoMech SUITE")
|
| 339 |
st.markdown(f"<div class='hero'>{hero_html}</div>", unsafe_allow_html=True)
|
| 340 |
|
|
|
|
| 346 |
if "pad_v" in style: s.append(f"--c-pv:{int(style['pad_v'])}px")
|
| 347 |
if "pad_h" in style: s.append(f"--c-ph:{int(style['pad_h'])}px")
|
| 348 |
if "bg_top" in style: s.append(f"--c-bg-top:{style['bg_top']}")
|
| 349 |
+
if "bg_bot" in style: s.append(f"--c-bg-bot:{style['bg_bot"]}")
|
| 350 |
+
if "border" in style: s.append(f"--c-border:{style['border"]}")
|
| 351 |
if "border_width" in style: s.append(f"--c-bw:{int(style['border_width'])}px")
|
| 352 |
+
if "title_color" in style: s.append(f"--c-title-color:{style['title_color"]}")
|
| 353 |
if "title_fs" in style: s.append(f"--c-title-fs:{int(style['title_fs'])}px")
|
| 354 |
+
if "blurb_color" in style: s.append(f"--c-blurb-color:{style['blurb_color"]}")
|
| 355 |
if "blurb_fs" in style: s.append(f"--c-blurb-fs:{int(style['blurb_fs'])}px")
|
| 356 |
+
if "btn_bg1" in style: s.append(f"--c-btn-bg1:{style['btn_bg1"]}")
|
| 357 |
+
if "btn_bg2" in style: s.append(f"--c-btn-bg2:{style['btn_bg2"]}")
|
| 358 |
+
if "btn_text" in style: s.append(f"--c-btn-text:{style['btn_text"]}")
|
| 359 |
+
if "btn_border" in style: s.append(f"--c-btn-border:{style['btn_border"]}")
|
| 360 |
if "btn_fs" in style: s.append(f"--c-btn-fs:{int(style['btn_fs'])}px")
|
| 361 |
+
if "btn_pad_v" in style: s.append(f"--c-btn-pv:{int(style['btn_pad_v"]) }px")
|
| 362 |
+
if "btn_pad_h" in style: s.append(f"--c-btn-ph:{int(style['btn_pad_h"]) }px")
|
| 363 |
+
if "icon_diam" in style: s.append(f"--c-icon-d:{int(style['icon_diam"]) }px")
|
| 364 |
+
if "icon_img" in style: s.append(f"--c-icon-img:{int(style['icon_img"]) }px")
|
| 365 |
+
if "icon_bg" in style: s.append(f"--c-icon-bg:{style['icon_bg"]}")
|
| 366 |
+
if "icon_border" in style: s.append(f"--c-icon-border:{style['icon_border"]}")
|
| 367 |
return "; ".join(s)
|
| 368 |
|
| 369 |
def app_card(card_cfg: Dict[str, Any]) -> str:
|