Spaces:
Running
Running
Space: mirror auto-battler styling — parchment theme, fonts, paper sidebar
Browse files- Re-theme the shell sidebar (sidebar.css) from a bespoke dark palette to the
auto-battler paper theme (paper-2 cream like the stage, ink text, 2px ink
borders, Space Grotesk / JetBrains Mono) so the gray/white-text drift is gone.
- Load Space Grotesk / JetBrains Mono / Fraunces on the Space + a parchment body
theme so the whole UI mirrors the app instead of Gradio's Montserrat-on-grey.
- Defend the extras buttons' font/size/padding with !important so Gradio's button
theme stops enlarging them.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- app.py +14 -1
- web/shell/sidebar.css +31 -24
- web/shell/spriteScene.css +11 -5
app.py
CHANGED
|
@@ -39,8 +39,21 @@ WEB = os.path.join(HERE, "web")
|
|
| 39 |
# every tab button present so the sidebar can drive navigation on any viewport.
|
| 40 |
HIDE_TABS = ('<style>.tab-container[role="tablist"]{position:absolute!important;'
|
| 41 |
'left:-99999px!important;top:0!important;width:1400px!important;}</style>')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
HEAD = ('<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">'
|
| 43 |
-
+ HIDE_TABS +
|
| 44 |
'<link rel="stylesheet" href="/web/shell/sidebar.css">'
|
| 45 |
'<link rel="stylesheet" href="/web/shell/spriteScene.css">'
|
| 46 |
'<script type="module" src="/web/tiny.js"></script>'
|
|
|
|
| 39 |
# every tab button present so the sidebar can drive navigation on any viewport.
|
| 40 |
HIDE_TABS = ('<style>.tab-container[role="tablist"]{position:absolute!important;'
|
| 41 |
'left:-99999px!important;top:0!important;width:1400px!important;}</style>')
|
| 42 |
+
# Load auto-battler's fonts + a parchment theme so the whole Space mirrors the app
|
| 43 |
+
# (Gradio's default is Montserrat on light grey). Applied with !important to beat
|
| 44 |
+
# Gradio's own theme.css; component cards/inputs keep their styling on top.
|
| 45 |
+
FONTS = ('<link rel="preconnect" href="https://fonts.googleapis.com">'
|
| 46 |
+
'<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>'
|
| 47 |
+
'<link rel="stylesheet" href="https://fonts.googleapis.com/css2?'
|
| 48 |
+
'family=Fraunces:opsz,wght@9..144,400..900&family=JetBrains+Mono:wght@400;500;700&'
|
| 49 |
+
'family=Space+Grotesk:wght@400;500;600;700&display=swap">')
|
| 50 |
+
THEME = ('<style>'
|
| 51 |
+
'body,gradio-app,.gradio-container{background:#f3ebdc !important;color:#141821;'
|
| 52 |
+
"font-family:'Space Grotesk',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif !important;}"
|
| 53 |
+
".gradio-container h1{font-family:'Fraunces',Georgia,serif !important;color:#141821;}"
|
| 54 |
+
'</style>')
|
| 55 |
HEAD = ('<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">'
|
| 56 |
+
+ HIDE_TABS + FONTS + THEME +
|
| 57 |
'<link rel="stylesheet" href="/web/shell/sidebar.css">'
|
| 58 |
'<link rel="stylesheet" href="/web/shell/spriteScene.css">'
|
| 59 |
'<script type="module" src="/web/tiny.js"></script>'
|
web/shell/sidebar.css
CHANGED
|
@@ -3,24 +3,31 @@
|
|
| 3 |
* nav.json. Everything is namespaced `.tac-*` so it never collides with Gradio's
|
| 4 |
* own classes. The collapse/slide is driven by a `tac-collapsed` class that
|
| 5 |
* sidebar.js toggles on <body>.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
*/
|
| 7 |
|
| 8 |
:root {
|
| 9 |
-
--tac-w:
|
| 10 |
-
--tac-bg: #
|
| 11 |
-
--tac-bg-2: #
|
| 12 |
-
--tac-
|
| 13 |
-
--tac-
|
| 14 |
-
--tac-
|
| 15 |
-
--tac-
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
/* The drawer — a fixed slide-in panel (works inside Gradio's flow). */
|
| 19 |
.tac-sidebar {
|
| 20 |
position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
|
| 21 |
width: var(--tac-w); box-sizing: border-box;
|
| 22 |
-
background: var(--tac-bg); border-right:
|
| 23 |
-
color: var(--tac-ink); font-family:
|
| 24 |
display: flex; flex-direction: column;
|
| 25 |
transform: translateX(0); transition: transform .22s ease;
|
| 26 |
overflow-y: auto;
|
|
@@ -34,8 +41,8 @@ body:not(.tac-collapsed) .gradio-container { margin-left: var(--tac-w); }
|
|
| 34 |
|
| 35 |
.tac-brand {
|
| 36 |
display: flex; align-items: center; gap: 8px;
|
| 37 |
-
padding: 14px 14px
|
| 38 |
-
border-bottom:
|
| 39 |
}
|
| 40 |
.tac-brand .tac-brand-icon { font-size: 18px; }
|
| 41 |
/* The collapse/reopen controls are <button>s; a host button theme (Gradio's
|
|
@@ -47,36 +54,36 @@ body:not(.tac-collapsed) .gradio-container { margin-left: var(--tac-w); }
|
|
| 47 |
display: inline-flex !important; align-items: center; justify-content: center;
|
| 48 |
width: 28px; height: 28px; padding: 0 !important;
|
| 49 |
background: var(--tac-bg-2) !important; color: var(--tac-muted) !important;
|
| 50 |
-
border:
|
| 51 |
}
|
| 52 |
.tac-sidebar .tac-brand .tac-collapse:hover {
|
| 53 |
-
background:
|
| 54 |
}
|
| 55 |
|
| 56 |
-
.tac-section { padding:
|
| 57 |
.tac-section-title {
|
| 58 |
-
font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
|
| 59 |
color: var(--tac-muted); padding: 4px 8px;
|
| 60 |
}
|
| 61 |
/* Nav items are <a>, so a host's link theme (e.g. Gradio's prefixed `.gradio-
|
| 62 |
* container .prose a`) out-specifies a plain class. As an embeddable shell we
|
| 63 |
-
* defend
|
| 64 |
-
* underline props, so the sidebar looks identical wherever it's mounted. */
|
| 65 |
.tac-sidebar .tac-nav-item {
|
| 66 |
display: flex; align-items: center; gap: 8px; width: 100%;
|
| 67 |
-
padding:
|
| 68 |
-
background: none; color: var(--tac-ink) !important; font: inherit;
|
| 69 |
-
cursor: pointer; text-decoration: none !important;
|
| 70 |
}
|
| 71 |
.tac-sidebar .tac-nav-item:hover { background: var(--tac-bg-2); }
|
| 72 |
-
.tac-sidebar .tac-nav-item.active { background:
|
| 73 |
-
.tac-sidebar .tac-nav-item .tac-ico { width: 18px; text-align: center;
|
|
|
|
| 74 |
|
| 75 |
/* Edge tab to reopen when collapsed. Same host-button defence as above. */
|
| 76 |
.tac-reopen {
|
| 77 |
position: fixed; top: 12px; left: 0; z-index: 1001; display: none;
|
| 78 |
background: var(--tac-bg) !important; color: var(--tac-ink) !important;
|
| 79 |
-
border:
|
| 80 |
border-radius: 0 8px 8px 0 !important; padding: 8px 10px !important;
|
| 81 |
cursor: pointer; font-size: 14px; line-height: 1;
|
| 82 |
}
|
|
@@ -85,6 +92,6 @@ body.tac-collapsed .tac-reopen { display: block; }
|
|
| 85 |
/* Mobile: the drawer overlays full-bleed-ish and never pushes content. JS
|
| 86 |
* auto-collapses below this width on load + resize. */
|
| 87 |
@media (max-width: 768px) {
|
| 88 |
-
.tac-sidebar { width: min(280px, 86vw); box-shadow: 4px 0 24px rgba(0,0,0,.
|
| 89 |
body:not(.tac-collapsed) .gradio-container { margin-left: 0; }
|
| 90 |
}
|
|
|
|
| 3 |
* nav.json. Everything is namespaced `.tac-*` so it never collides with Gradio's
|
| 4 |
* own classes. The collapse/slide is driven by a `tac-collapsed` class that
|
| 5 |
* sidebar.js toggles on <body>.
|
| 6 |
+
*
|
| 7 |
+
* Palette + fonts mirror the auto-battler theme (parchment paper-2 like the pixi
|
| 8 |
+
* stage, ink text, 2px ink borders, Space Grotesk / JetBrains Mono) so the Space
|
| 9 |
+
* shell matches the app instead of a bespoke dark theme.
|
| 10 |
*/
|
| 11 |
|
| 12 |
:root {
|
| 13 |
+
--tac-w: 240px;
|
| 14 |
+
--tac-bg: #ece2cc; /* paper-2 — same cream as the pixi stage */
|
| 15 |
+
--tac-bg-2: #e2d6ba; /* paper-3 — hover */
|
| 16 |
+
--tac-paper: #f3ebdc; /* paper — text on an ink fill */
|
| 17 |
+
--tac-ink: #141821; /* ink — text + borders */
|
| 18 |
+
--tac-muted: #6d6a5f; /* ink-muted */
|
| 19 |
+
--tac-accent: #d8271a; /* transmit — accent */
|
| 20 |
+
--tac-border: #141821;
|
| 21 |
+
--tac-font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
| 22 |
+
--tac-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
|
| 23 |
}
|
| 24 |
|
| 25 |
/* The drawer — a fixed slide-in panel (works inside Gradio's flow). */
|
| 26 |
.tac-sidebar {
|
| 27 |
position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
|
| 28 |
width: var(--tac-w); box-sizing: border-box;
|
| 29 |
+
background: var(--tac-bg); border-right: 2px solid var(--tac-border);
|
| 30 |
+
color: var(--tac-ink); font-family: var(--tac-font);
|
| 31 |
display: flex; flex-direction: column;
|
| 32 |
transform: translateX(0); transition: transform .22s ease;
|
| 33 |
overflow-y: auto;
|
|
|
|
| 41 |
|
| 42 |
.tac-brand {
|
| 43 |
display: flex; align-items: center; gap: 8px;
|
| 44 |
+
padding: 14px 14px 12px; font-weight: 700; font-size: 16px; letter-spacing: .01em;
|
| 45 |
+
color: var(--tac-ink); border-bottom: 2px solid var(--tac-border);
|
| 46 |
}
|
| 47 |
.tac-brand .tac-brand-icon { font-size: 18px; }
|
| 48 |
/* The collapse/reopen controls are <button>s; a host button theme (Gradio's
|
|
|
|
| 54 |
display: inline-flex !important; align-items: center; justify-content: center;
|
| 55 |
width: 28px; height: 28px; padding: 0 !important;
|
| 56 |
background: var(--tac-bg-2) !important; color: var(--tac-muted) !important;
|
| 57 |
+
border: 1.5px solid var(--tac-border) !important; border-radius: 6px !important;
|
| 58 |
}
|
| 59 |
.tac-sidebar .tac-brand .tac-collapse:hover {
|
| 60 |
+
background: var(--tac-ink) !important; color: var(--tac-paper) !important;
|
| 61 |
}
|
| 62 |
|
| 63 |
+
.tac-section { padding: 12px 8px 0; }
|
| 64 |
.tac-section-title {
|
| 65 |
+
font-family: var(--tac-mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
|
| 66 |
color: var(--tac-muted); padding: 4px 8px;
|
| 67 |
}
|
| 68 |
/* Nav items are <a>, so a host's link theme (e.g. Gradio's prefixed `.gradio-
|
| 69 |
* container .prose a`) out-specifies a plain class. As an embeddable shell we
|
| 70 |
+
* defend colour/underline with `!important` so it looks the same wherever mounted. */
|
|
|
|
| 71 |
.tac-sidebar .tac-nav-item {
|
| 72 |
display: flex; align-items: center; gap: 8px; width: 100%;
|
| 73 |
+
padding: 7px 10px; margin: 1px 0; border: 0; border-radius: 6px;
|
| 74 |
+
background: none; color: var(--tac-ink) !important; font: inherit; font-family: var(--tac-font);
|
| 75 |
+
font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; text-decoration: none !important;
|
| 76 |
}
|
| 77 |
.tac-sidebar .tac-nav-item:hover { background: var(--tac-bg-2); }
|
| 78 |
+
.tac-sidebar .tac-nav-item.active { background: var(--tac-ink); color: var(--tac-paper) !important; }
|
| 79 |
+
.tac-sidebar .tac-nav-item .tac-ico { width: 18px; text-align: center; color: var(--tac-accent); }
|
| 80 |
+
.tac-sidebar .tac-nav-item.active .tac-ico { color: #e8a72a; } /* amber, like the app's active world icon */
|
| 81 |
|
| 82 |
/* Edge tab to reopen when collapsed. Same host-button defence as above. */
|
| 83 |
.tac-reopen {
|
| 84 |
position: fixed; top: 12px; left: 0; z-index: 1001; display: none;
|
| 85 |
background: var(--tac-bg) !important; color: var(--tac-ink) !important;
|
| 86 |
+
border: 2px solid var(--tac-border) !important; border-left: 0 !important;
|
| 87 |
border-radius: 0 8px 8px 0 !important; padding: 8px 10px !important;
|
| 88 |
cursor: pointer; font-size: 14px; line-height: 1;
|
| 89 |
}
|
|
|
|
| 92 |
/* Mobile: the drawer overlays full-bleed-ish and never pushes content. JS
|
| 93 |
* auto-collapses below this width on load + resize. */
|
| 94 |
@media (max-width: 768px) {
|
| 95 |
+
.tac-sidebar { width: min(280px, 86vw); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
|
| 96 |
body:not(.tac-collapsed) .gradio-container { margin-left: 0; }
|
| 97 |
}
|
web/shell/spriteScene.css
CHANGED
|
@@ -15,8 +15,9 @@
|
|
| 15 |
--mv-card: #fbf6ea;
|
| 16 |
--mv-transmit: #d8271a;
|
| 17 |
--mv-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
|
|
|
|
| 18 |
display: flex; height: 100%; width: 100%; box-sizing: border-box;
|
| 19 |
-
color: var(--mv-ink);
|
| 20 |
}
|
| 21 |
.movement-view * { box-sizing: border-box; }
|
| 22 |
|
|
@@ -42,7 +43,8 @@
|
|
| 42 |
* `.prose a`) that would otherwise turn these into blue underlined links. */
|
| 43 |
.movement-char {
|
| 44 |
display: block; padding: 5px 10px; margin: 1px 0; border-radius: 4px;
|
| 45 |
-
color: var(--mv-ink) !important; text-decoration: none !important;
|
|
|
|
| 46 |
}
|
| 47 |
.movement-char:hover { background: var(--mv-paper); }
|
| 48 |
.movement-char.active { background: var(--mv-ink); color: var(--mv-card) !important; }
|
|
@@ -89,10 +91,14 @@
|
|
| 89 |
font-family: var(--mv-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--mv-ink-muted);
|
| 90 |
}
|
| 91 |
.movement-extras-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
|
|
|
|
|
|
|
| 92 |
.movement-extra {
|
| 93 |
-
font-family: var(--mv-mono); font-size: 9px;
|
| 94 |
-
|
| 95 |
-
|
|
|
|
|
|
|
| 96 |
}
|
| 97 |
.movement-extra:hover { background: var(--mv-paper) !important; }
|
| 98 |
.movement-extra.active { color: var(--mv-card) !important; background: var(--mv-ink) !important; }
|
|
|
|
| 15 |
--mv-card: #fbf6ea;
|
| 16 |
--mv-transmit: #d8271a;
|
| 17 |
--mv-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
|
| 18 |
+
--mv-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
| 19 |
display: flex; height: 100%; width: 100%; box-sizing: border-box;
|
| 20 |
+
color: var(--mv-ink); font-family: var(--mv-sans);
|
| 21 |
}
|
| 22 |
.movement-view * { box-sizing: border-box; }
|
| 23 |
|
|
|
|
| 43 |
* `.prose a`) that would otherwise turn these into blue underlined links. */
|
| 44 |
.movement-char {
|
| 45 |
display: block; padding: 5px 10px; margin: 1px 0; border-radius: 4px;
|
| 46 |
+
color: var(--mv-ink) !important; text-decoration: none !important;
|
| 47 |
+
font-family: var(--mv-sans); font-size: 13px; font-weight: 500; cursor: pointer;
|
| 48 |
}
|
| 49 |
.movement-char:hover { background: var(--mv-paper); }
|
| 50 |
.movement-char.active { background: var(--mv-ink); color: var(--mv-card) !important; }
|
|
|
|
| 91 |
font-family: var(--mv-mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--mv-ink-muted);
|
| 92 |
}
|
| 93 |
.movement-extras-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
|
| 94 |
+
/* Host button themes (Gradio's `.gradio-container button`) enlarge these and swap
|
| 95 |
+
* the font — defend the type + box props with `!important` so they stay small mono. */
|
| 96 |
.movement-extra {
|
| 97 |
+
font-family: var(--mv-mono) !important; font-size: 9px !important; line-height: 1.2 !important;
|
| 98 |
+
letter-spacing: .04em !important; text-transform: uppercase !important; font-weight: 500 !important;
|
| 99 |
+
color: var(--mv-ink) !important; background: var(--mv-card) !important; border: 1.5px solid var(--mv-ink) !important;
|
| 100 |
+
cursor: pointer; padding: 2px 6px !important; display: inline-flex; align-items: center; gap: 4px;
|
| 101 |
+
min-height: 0 !important; border-radius: 0 !important; box-shadow: none !important;
|
| 102 |
}
|
| 103 |
.movement-extra:hover { background: var(--mv-paper) !important; }
|
| 104 |
.movement-extra.active { color: var(--mv-card) !important; background: var(--mv-ink) !important; }
|