DeltaZN commited on
Commit
79b1013
Β·
1 Parent(s): 6dcaba3

fix: dark theme

Browse files
src/god_simulator/ui/card_check.html CHANGED
@@ -1,4 +1,4 @@
1
- <div class="gs-card-head dark">
2
- <div class="gs-tile dark">πŸ”</div>
3
  <h2>Check your character</h2>
4
  </div>
 
1
+ <div class="gs-card-head hud">
2
+ <div class="gs-tile hud">πŸ”</div>
3
  <h2>Check your character</h2>
4
  </div>
src/god_simulator/ui/lobby.css CHANGED
@@ -41,6 +41,130 @@ body::before {
41
  background-size: 32px 32px;
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  .gradio-container {
45
  max-width: 1180px !important;
46
  margin: 0 auto !important;
@@ -49,8 +173,10 @@ body::before {
49
  box-shadow: none !important;
50
  }
51
 
52
- /* Hide Gradio's default footer */
53
- footer.svelte-1ax1toq, .svelte-1ax1toq > footer, div.footer {
 
 
54
  display: none !important;
55
  }
56
 
@@ -187,7 +313,9 @@ footer.svelte-1ax1toq, .svelte-1ax1toq > footer, div.footer {
187
  }
188
  .gs-card-head.sky { background: #e2f3fb; }
189
  .gs-card-head.brick { background: #fbeae2; }
190
- .gs-card-head.dark { background: #eef3f7; }
 
 
191
  .gs-card-head h2 {
192
  margin: 0;
193
  font-family: 'Baloo 2', cursive !important;
@@ -208,7 +336,7 @@ footer.svelte-1ax1toq, .svelte-1ax1toq > footer, div.footer {
208
  }
209
  .gs-tile.sky { background: var(--sky); }
210
  .gs-tile.brick { background: var(--brick); }
211
- .gs-tile.dark { background: var(--hud-2); border-color: #0c121c; }
212
 
213
  /* Card body content injected via gr.HTML */
214
  .gs-card-body {
@@ -351,6 +479,14 @@ footer.svelte-1ax1toq, .svelte-1ax1toq > footer, div.footer {
351
  padding: 13px 14px !important;
352
  margin: 0 !important;
353
  }
 
 
 
 
 
 
 
 
354
 
355
  /* ── Voxel buttons ── */
356
  /* Gradio places elem_id directly on the <button> or <a> element */
 
41
  background-size: 32px 32px;
42
  }
43
 
44
+ /* Gradio's <gradio-app> host paints --body-background-fill (white in light,
45
+ near-black in dark) over our body gradient β€” keep it transparent so the
46
+ sky→grass gradient shows through. */
47
+ gradio-app {
48
+ background: transparent !important;
49
+ }
50
+
51
+ /* Gradio's .styler / .form wrappers carry their own surface fill that sits on
52
+ top of our .gs-card β€” keep them transparent so the card shows through. */
53
+ .gs-card .styler,
54
+ .gs-card .form {
55
+ background: transparent !important;
56
+ border: none !important;
57
+ }
58
+
59
+ /* ===================== DARK THEME (nighttime world) =====================
60
+ Gradio adds `body.dark` based on the visitor's system preference. Map it to
61
+ the design's nighttime voxel palette (mirrors the design's [data-theme="dark"]).
62
+ Most rules below just redefine the palette vars; the explicit overrides cover
63
+ spots in this file that hard-code light hex, plus Gradio's own theme vars. */
64
+ body.dark {
65
+ --grass: #6fb841;
66
+ --grass-mid: #4f9a2c;
67
+ --grass-dark: #356615;
68
+ --brick: #c25f3c;
69
+ --brick-dark: #7e3219;
70
+ --ink: #e8eef5;
71
+ --ink-soft: #9fb0c2;
72
+ --paper: #1a2230;
73
+ --paper-2: #131a26;
74
+ --cyan: #5fd3f2;
75
+
76
+ /* Gradio component variables β†’ dark surfaces matching the palette */
77
+ --body-text-color: #e8eef5;
78
+ --body-text-color-subdued: #9fb0c2;
79
+ --background-fill-primary: #1a2230;
80
+ --background-fill-secondary: #131a26;
81
+ --block-background-fill: #1a2230;
82
+ --block-label-background-fill: #1a2230;
83
+ --input-background-fill: #0f1623;
84
+ --input-background-fill-focus: #101a26;
85
+ --border-color-primary: #33415a;
86
+ --block-border-color: #33415a;
87
+ }
88
+ body.dark {
89
+ background:
90
+ radial-gradient(120% 80% at 50% -10%, #1e3346 0%, transparent 55%),
91
+ linear-gradient(180deg, #0c131e 0%, #0f1826 40%, #101d22 74%, #14201a 100%) !important;
92
+ }
93
+ body.dark::before {
94
+ background-image:
95
+ linear-gradient(rgba(120,170,210,.05) 1px, transparent 1px),
96
+ linear-gradient(90deg, rgba(120,170,210,.05) 1px, transparent 1px);
97
+ }
98
+
99
+ /* NB: for descendant rules use the bare `.dark` ancestor (Gradio's dark-mode
100
+ class on <body>), NOT `body.dark X`. Gradio's CSS scoper rewrites the latter
101
+ to `.dark .gradio-container ... .contain body X`, placing `body` as a
102
+ descendant of `.contain`, which never matches. `.dark X` scopes correctly. */
103
+
104
+ /* Cards: the base rule borders with var(--ink), which is light text in dark
105
+ mode β€” pin the border/shadow to the design's near-black instead. */
106
+ .dark .gs-card {
107
+ border-color: #0a0f17 !important;
108
+ box-shadow: 0 8px 0 #0a0f17, 0 22px 40px -22px rgba(0,0,0,.7) !important;
109
+ }
110
+ .dark .gs-card-head { border-bottom-color: #0a0f17; }
111
+ .dark .gs-card-head.sky { background: #1c2c3a; }
112
+ .dark .gs-card-head.brick { background: #33231c; }
113
+ .dark .gs-card-head.hud { background: #222d3d; }
114
+
115
+ /* Inputs (textbox + dropdown). NB: give each `.dark` selector its own rule β€” do
116
+ NOT comma-group them. Gradio's scoper inserts a stray second `.dark` into the
117
+ 2nd+ members of a comma group (e.g. `.contain .dark .gs-card ...`), so only the
118
+ first member ever matches. */
119
+ .dark .gs-card input {
120
+ background: #0f1623 !important;
121
+ border-color: #33415a !important;
122
+ color: var(--ink) !important;
123
+ }
124
+ .dark .gs-card textarea {
125
+ background: #0f1623 !important;
126
+ border-color: #33415a !important;
127
+ color: var(--ink) !important;
128
+ }
129
+ .dark .gs-card .svelte-1xfsv4t input[role="listbox"] {
130
+ background: #0f1623 !important;
131
+ border-color: #33415a !important;
132
+ color: var(--ink) !important;
133
+ }
134
+ .dark .gs-card input::placeholder { color: #6b7d92 !important; }
135
+ .dark .gs-card input:focus {
136
+ border-color: var(--grass-mid) !important;
137
+ background: #101a26 !important;
138
+ box-shadow: 0 0 0 4px rgba(111,184,65,.25) !important;
139
+ }
140
+ .dark .gs-card textarea:focus {
141
+ border-color: var(--grass-mid) !important;
142
+ background: #101a26 !important;
143
+ box-shadow: 0 0 0 4px rgba(111,184,65,.25) !important;
144
+ }
145
+ .dark .gs-card .svelte-1xfsv4t input[role="listbox"]:focus {
146
+ border-color: var(--grass-mid) !important;
147
+ background: #101a26 !important;
148
+ box-shadow: 0 0 0 4px rgba(111,184,65,.25) !important;
149
+ }
150
+
151
+ /* Voxel tiles: deepen the inner bevel for the night palette */
152
+ .dark .gs-tile {
153
+ box-shadow: inset -4px -4px 0 rgba(0,0,0,.3), inset 4px 4px 0 rgba(255,255,255,.18), 0 4px 0 rgba(0,0,0,.4);
154
+ }
155
+
156
+ /* "Check status" (hud) button */
157
+ .dark #gs-btn-status {
158
+ background: #2a3a52 !important;
159
+ border-color: #0a0f17 !important;
160
+ box-shadow: 0 6px 0 #0a0f17 !important;
161
+ }
162
+ .dark #gs-btn-status:active { box-shadow: 0 0 0 #0a0f17 !important; }
163
+
164
+ /* Dim the ground + footer at night */
165
+ .dark .gs-ground { box-shadow: inset 0 5px 0 rgba(255,255,255,.08); filter: brightness(.82); }
166
+ .dark .gs-footer { filter: brightness(.82); }
167
+
168
  .gradio-container {
169
  max-width: 1180px !important;
170
  margin: 0 auto !important;
 
173
  box-shadow: none !important;
174
  }
175
 
176
+ /* Hide Gradio's default footer. The svelte hash changes between versions, so
177
+ target the semantic <footer> element β€” our custom footer is .gs-footer (a div). */
178
+ gradio-app footer,
179
+ .gradio-container footer {
180
  display: none !important;
181
  }
182
 
 
313
  }
314
  .gs-card-head.sky { background: #e2f3fb; }
315
  .gs-card-head.brick { background: #fbeae2; }
316
+ /* NB: avoid the class name `dark` here β€” Gradio's CSS scoper treats `.dark` as
317
+ its reserved dark-mode class and hoists it to an ancestor selector. */
318
+ .gs-card-head.hud { background: #eef3f7; }
319
  .gs-card-head h2 {
320
  margin: 0;
321
  font-family: 'Baloo 2', cursive !important;
 
336
  }
337
  .gs-tile.sky { background: var(--sky); }
338
  .gs-tile.brick { background: var(--brick); }
339
+ .gs-tile.hud { background: var(--hud-2); border-color: #0c121c; }
340
 
341
  /* Card body content injected via gr.HTML */
342
  .gs-card-body {
 
479
  padding: 13px 14px !important;
480
  margin: 0 !important;
481
  }
482
+ /* Dropdown focus β€” the base listbox rule above is highly specific, so it needs
483
+ its own :focus variant to pick up the grass-green focus ring like text inputs. */
484
+ .gs-card .svelte-1xfsv4t input[role="listbox"]:focus {
485
+ border-color: var(--grass-mid) !important;
486
+ background: #fff !important;
487
+ box-shadow: 0 0 0 4px rgba(116,192,67,.22) !important;
488
+ outline: none !important;
489
+ }
490
 
491
  /* ── Voxel buttons ── */
492
  /* Gradio places elem_id directly on the <button> or <a> element */