File size: 11,335 Bytes
9b1c59c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | """OnCallEnv Red Shift — Ops Room Gradio theme.
Visual language: Datadog / Grafana / Linear. Cool grays, single electric-blue
accent for primary actions, amber for warnings, red for critical. No neon, no
scanlines, no cyberpunk flourishes. Optimized for projector readability during
a 3-minute pitch.
"""
from __future__ import annotations
import gradio as gr
from gradio.themes.base import Base
from gradio.themes.utils import colors, fonts, sizes
class OpsRoomTheme(Base):
"""Production-grade observability aesthetic for OnCallEnv Red Shift."""
def __init__(
self,
*,
primary_hue: colors.Color | str = colors.blue,
secondary_hue: colors.Color | str = colors.amber,
neutral_hue: colors.Color | str = colors.slate,
spacing_size: sizes.Size | str = sizes.spacing_md,
radius_size: sizes.Size | str = sizes.radius_md,
text_size: sizes.Size | str = sizes.text_md,
font: fonts.Font | str | list = (
fonts.GoogleFont("Inter"),
"ui-sans-serif",
"system-ui",
"sans-serif",
),
font_mono: fonts.Font | str | list = (
fonts.GoogleFont("JetBrains Mono"),
"ui-monospace",
"Consolas",
"monospace",
),
):
super().__init__(
primary_hue=primary_hue,
secondary_hue=secondary_hue,
neutral_hue=neutral_hue,
spacing_size=spacing_size,
radius_size=radius_size,
text_size=text_size,
font=font,
font_mono=font_mono,
)
# Body / surface
self.body_background_fill = "#0b1020"
self.body_background_fill_dark = "#0b1020"
self.body_text_color = "#d6deeb"
self.body_text_color_dark = "#d6deeb"
self.body_text_color_subdued = "#7d8ba1"
self.body_text_color_subdued_dark = "#7d8ba1"
# Blocks / panels
self.block_background_fill = "#131a2e"
self.block_background_fill_dark = "#131a2e"
self.block_border_color = "#1f2940"
self.block_border_color_dark = "#1f2940"
self.block_border_width = "1px"
self.block_label_background_fill = "#0f1626"
self.block_label_background_fill_dark = "#0f1626"
self.block_label_text_color = "#7aa7ff"
self.block_label_text_color_dark = "#7aa7ff"
self.block_shadow = "0 1px 3px rgba(0,0,0,0.25)"
self.block_shadow_dark = "0 1px 3px rgba(0,0,0,0.25)"
self.block_title_text_color = "#e6edf7"
self.block_title_text_color_dark = "#e6edf7"
# Borders
self.border_color_accent = "#3b82f6"
self.border_color_accent_dark = "#3b82f6"
self.border_color_primary = "#1f2940"
self.border_color_primary_dark = "#1f2940"
self.panel_background_fill = "#0f1626"
self.panel_background_fill_dark = "#0f1626"
self.panel_border_color = "#1f2940"
self.panel_border_color_dark = "#1f2940"
# Primary button (electric blue)
self.button_primary_background_fill = "#3b82f6"
self.button_primary_background_fill_dark = "#3b82f6"
self.button_primary_background_fill_hover = "#60a5fa"
self.button_primary_background_fill_hover_dark = "#60a5fa"
self.button_primary_text_color = "#ffffff"
self.button_primary_text_color_dark = "#ffffff"
self.button_primary_border_color = "#2563eb"
self.button_primary_border_color_dark = "#2563eb"
# Secondary button
self.button_secondary_background_fill = "#1f2940"
self.button_secondary_background_fill_dark = "#1f2940"
self.button_secondary_background_fill_hover = "#2a3656"
self.button_secondary_background_fill_hover_dark = "#2a3656"
self.button_secondary_text_color = "#d6deeb"
self.button_secondary_text_color_dark = "#d6deeb"
self.button_secondary_border_color = "#2a3656"
self.button_secondary_border_color_dark = "#2a3656"
# Inputs
self.input_background_fill = "#0f1626"
self.input_background_fill_dark = "#0f1626"
self.input_border_color = "#1f2940"
self.input_border_color_dark = "#1f2940"
self.input_border_color_focus = "#3b82f6"
self.input_border_color_focus_dark = "#3b82f6"
self.input_placeholder_color = "#5b6577"
self.input_placeholder_color_dark = "#5b6577"
self.input_text_color = "#d6deeb"
self.input_text_color_dark = "#d6deeb"
# Checkbox
self.checkbox_background_color = "#0f1626"
self.checkbox_background_color_dark = "#0f1626"
self.checkbox_background_color_selected = "#3b82f6"
self.checkbox_background_color_selected_dark = "#3b82f6"
self.checkbox_border_color = "#2a3656"
self.checkbox_border_color_dark = "#2a3656"
self.checkbox_border_color_selected = "#3b82f6"
self.checkbox_border_color_selected_dark = "#3b82f6"
# Tables / code
self.table_border_color = "#1f2940"
self.table_border_color_dark = "#1f2940"
self.table_even_background_fill = "#131a2e"
self.table_even_background_fill_dark = "#131a2e"
self.table_odd_background_fill = "#0f1626"
self.table_odd_background_fill_dark = "#0f1626"
self.code_background_fill = "#0f1626"
self.code_background_fill_dark = "#0f1626"
# Shadows
self.shadow_drop = "0 1px 3px rgba(0,0,0,0.3)"
self.shadow_drop_lg = "0 4px 12px rgba(0,0,0,0.4)"
# --------------------------------------------------------------------------
# Custom CSS — overrides + bespoke components
# --------------------------------------------------------------------------
CUSTOM_CSS = """
:root {
--ops-bg: #0b1020;
--ops-surface: #131a2e;
--ops-surface-alt: #0f1626;
--ops-border: #1f2940;
--ops-border-strong: #2a3656;
--ops-text: #d6deeb;
--ops-text-dim: #7d8ba1;
--ops-text-bright: #e6edf7;
--ops-blue: #3b82f6;
--ops-blue-bright: #60a5fa;
--ops-amber: #f59e0b;
--ops-red: #ef4444;
--ops-green: #10b981;
--ops-purple: #8b5cf6;
}
footer { display: none !important; }
.gradio-container {
background: var(--ops-bg) !important;
max-width: 100% !important;
padding: 0 !important;
}
.gradio-container > .main {
max-width: 1600px;
margin: 0 auto;
padding: 0 24px;
}
/* ============== TAB HEADERS ============== */
.tab-nav button {
background: transparent !important;
color: var(--ops-text-dim) !important;
border: none !important;
border-bottom: 2px solid transparent !important;
font-family: 'Inter', sans-serif !important;
font-size: 0.875rem !important;
font-weight: 500 !important;
letter-spacing: 0.01em;
padding: 12px 20px !important;
transition: all 0.15s ease;
}
.tab-nav button:hover {
color: var(--ops-text-bright) !important;
}
.tab-nav button.selected {
color: var(--ops-blue-bright) !important;
border-bottom: 2px solid var(--ops-blue) !important;
background: transparent !important;
}
/* ============== HEADER BANNER ============== */
.ops-header {
padding: 28px 24px 24px;
background: linear-gradient(180deg, #0d1428 0%, var(--ops-bg) 100%);
border-bottom: 1px solid var(--ops-border);
margin-bottom: 16px;
}
.ops-header-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
flex-wrap: wrap;
}
.ops-header h1 {
font-family: 'Inter', sans-serif;
font-size: 1.875rem;
font-weight: 700;
color: var(--ops-text-bright);
margin: 0 0 4px 0;
letter-spacing: -0.02em;
}
.ops-header .subtitle {
font-family: 'Inter', sans-serif;
font-size: 0.875rem;
color: var(--ops-text-dim);
letter-spacing: 0.01em;
}
.ops-header-meta {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.ops-pill {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
border-radius: 4px;
font-family: 'JetBrains Mono', monospace;
font-size: 0.7rem;
font-weight: 500;
letter-spacing: 0.04em;
border: 1px solid var(--ops-border-strong);
background: var(--ops-surface-alt);
color: var(--ops-text-dim);
}
.ops-pill-blue {
color: var(--ops-blue-bright);
border-color: rgba(59, 130, 246, 0.3);
background: rgba(59, 130, 246, 0.08);
}
.ops-pill-green {
color: var(--ops-green);
border-color: rgba(16, 185, 129, 0.3);
background: rgba(16, 185, 129, 0.08);
}
.ops-pill .dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
/* ============== CARDS ============== */
.ops-card {
background: var(--ops-surface) !important;
border: 1px solid var(--ops-border) !important;
border-radius: 8px !important;
padding: 16px !important;
}
/* ============== PRIMARY BUTTON ============== */
button.primary {
font-weight: 600 !important;
letter-spacing: 0.01em !important;
transition: all 0.15s ease !important;
box-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}
button.primary:hover {
transform: translateY(-1px);
box-shadow: 0 4px 8px rgba(59, 130, 246, 0.25) !important;
}
/* ============== TYPOGRAPHY ============== */
.prose h1, .prose h2, .prose h3, .prose h4 {
color: var(--ops-text-bright) !important;
font-family: 'Inter', sans-serif !important;
letter-spacing: -0.01em;
}
.prose h2 { font-size: 1.25rem !important; margin-top: 1.5rem !important; }
.prose h3 { font-size: 1.05rem !important; margin-top: 1.25rem !important; }
.prose p, .prose li {
color: var(--ops-text) !important;
line-height: 1.65;
}
.prose strong {
color: var(--ops-text-bright) !important;
font-weight: 600;
}
.prose a {
color: var(--ops-blue-bright) !important;
}
.prose code {
background: var(--ops-surface-alt) !important;
color: var(--ops-blue-bright) !important;
padding: 2px 6px;
border-radius: 4px;
font-family: 'JetBrains Mono', monospace !important;
font-size: 0.875em;
border: 1px solid var(--ops-border);
}
.prose pre {
background: var(--ops-surface-alt) !important;
border: 1px solid var(--ops-border) !important;
border-radius: 6px;
}
.prose hr {
border-color: var(--ops-border) !important;
}
.prose table {
border-collapse: collapse;
font-size: 0.875rem;
}
.prose th {
background: var(--ops-surface-alt) !important;
color: var(--ops-text-bright) !important;
border: 1px solid var(--ops-border) !important;
padding: 8px 12px !important;
text-align: left;
}
.prose td {
border: 1px solid var(--ops-border) !important;
padding: 6px 12px !important;
}
/* ============== SCROLLBAR ============== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ops-bg); }
::-webkit-scrollbar-thumb {
background: var(--ops-border-strong);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #3a4a6a; }
"""
HEADER_HTML = """
<div class="ops-header">
<div class="ops-header-row">
<div>
<h1>OnCallEnv: Red Shift</h1>
<div class="subtitle">RL training environment for autonomous incident response</div>
</div>
<div class="ops-header-meta">
<span class="ops-pill ops-pill-green"><span class="dot"></span>ENV READY</span>
<span class="ops-pill ops-pill-blue">QWEN2.5-3B · GRPO</span>
<span class="ops-pill">OPENENV 0.2</span>
</div>
</div>
</div>
"""
|