chore(agent): move screen.html inline styles into agent.css; add --blue/--yellow/--subtext0 to palette

This commit is contained in:
iris 2026-06-02 10:51:00 +02:00 committed by mara
commit ae695931ce
4 changed files with 112 additions and 74 deletions

View file

@ -2,7 +2,7 @@
All colour variables are declared **once** in
`frontend/packages/shared/src/base.css` under `:root`.
Per-page stylesheets (`dashboard.css`, `agent.css`) must reference these
Per-page stylesheets (`common.css`, `dashboard.css`, `flow.css`, `logs.css`, `agent.css`) must reference these
names and must **not** redeclare them.
## Palette (`base.css`)
@ -17,11 +17,14 @@ names and must **not** redeclare them.
| `--purple` | `#cba6f7` | mauve | accent — active tabs, links, highlights |
| `--purple-dim` | `#45475a` | surface1 | subtle borders, terminal chrome, badge backgrounds |
| `--cyan` | `#89dceb` | sky | tool-use events, info accents |
| `--blue` | `#89b4fa` | blue | links, interactive accent (distinct from sky) |
| `--pink` | `#f5c2e7` | pink | thinking events |
| `--amber` | `#fab387` | peach | warnings, pending / running state |
| `--yellow` | `#f9e2af` | yellow | flash messages, mild warnings |
| `--green` | `#a6e3a1` | green | success, ok state |
| `--red` | `#f38ba8` | red | errors, fail state |
| `--border` | `#313244` | surface0 | general borders, hover/active backgrounds |
| `--subtext0` | `#a6adc8` | subtext0 | secondary toolbar/status text; dimmer than `--fg`, lighter than `--muted` |
## Common mistakes

View file

@ -23,8 +23,9 @@ html, body { height: 100%; margin: 0; }
/* Legacy in-page layout retained for the sibling stats page
(`stats.html`) which doesn't apply `body.agent-shell` and stays
on a normal-document scroll. */
body:not(.agent-shell) {
on a normal-document scroll. screen-shell is also excluded it
manages its own full-viewport layout below. */
body:not(.agent-shell):not(.screen-shell) {
max-width: 110em;
margin: 1.5em auto;
padding: 0 1.5em;
@ -1033,3 +1034,103 @@ pre.diff {
.stats-card.wide .chart-wrap { height: 260px; }
.stats-empty-note { color: var(--muted); font-style: italic; }
/* ─── /screen page ─── */
/* Full-screen VNC canvas viewer (screen.html). All rules scoped to
body.screen-shell so they can coexist with the agent/stats rules. */
body.screen-shell {
font-size: 14px;
overflow: hidden;
}
/* Toolbar strip at the top of the screen page. */
#toolbar {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.4rem 0.75rem;
background: var(--bg-elev);
border-bottom: 1px solid var(--border);
}
#toolbar a {
color: var(--blue);
text-decoration: none;
font-size: 0.85rem;
}
#toolbar a:hover { text-decoration: underline; }
/* Toolbar toggle buttons (fit / match-size / debug). */
.tbtn {
padding: 0.15rem 0.5rem;
font-size: 0.72rem;
font-family: inherit;
background: var(--border);
color: var(--subtext0);
border: 1px solid var(--purple-dim);
border-radius: 4px;
cursor: pointer;
}
.tbtn.active { color: var(--green); border-color: var(--green); }
.tbtn:disabled { opacity: 0.4; cursor: default; }
/* Connection status chip at the right end of the toolbar. */
#status {
margin-left: auto;
font-size: 0.75rem;
color: var(--subtext0);
}
#status.connected { color: var(--green); }
#status.error { color: var(--red); }
/* RFB debug log — fixed panel at the bottom, hidden by default. */
#debug-log {
position: fixed;
bottom: 0; left: 0; right: 0;
max-height: 40vh;
overflow-y: auto;
background: rgba(17, 17, 27, 0.95);
border-top: 1px solid var(--purple-dim);
font-size: 0.72rem;
font-family: ui-monospace, monospace;
padding: 0.4rem 0.6rem;
z-index: 100;
display: none; /* toggled by the debug button */
}
#debug-log .dbg-line { color: var(--subtext0); margin: 1px 0; white-space: pre; }
#debug-log .dbg-line.err { color: var(--red); }
#debug-log .dbg-line.ok { color: var(--green); }
#debug-log .dbg-line.send { color: var(--blue); }
/* Canvas container — centres the VNC framebuffer. */
#canvas-wrap {
display: flex;
justify-content: center;
align-items: flex-start;
width: 100%;
height: calc(100% - 36px);
overflow: auto;
background: var(--crust);
}
/* Fit mode: canvas scaled in JS to fill the container. */
#canvas-wrap.fit { align-items: center; overflow: hidden; }
#canvas-wrap canvas { display: block; cursor: default; }
/* Pin the canvas to the JS-calculated size; prevents flex-item
min-width:auto from silently expanding beyond the scaled size. */
#canvas-wrap.fit canvas { flex: none; min-width: 0; min-height: 0; }
/* Transient flash message (copy-text, disconnect, etc.). */
#msg {
position: fixed;
bottom: 1rem;
left: 50%;
transform: translateX(-50%);
background: var(--border);
color: var(--yellow);
border-radius: 6px;
padding: 0.4rem 0.9rem;
font-size: 0.8rem;
opacity: 0;
transition: opacity 0.3s;
pointer-events: none;
}

View file

@ -5,78 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>screen</title>
<link rel="icon" type="image/svg+xml" href="icon">
<style>
/* Catppuccin Mocha palette (mirrors base.css) */
:root {
--base: #1e1e2e;
--mantle: #181825;
--crust: #11111b;
--text: #cdd6f4;
--subtext0:#a6adc8;
--surface0:#313244;
--surface1:#45475a;
--blue: #89b4fa;
--red: #f38ba8;
--green: #a6e3a1;
--yellow: #f9e2af;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--base); color: var(--text);
font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
font-size: 14px; }
#toolbar {
display: flex; align-items: center; gap: 0.75rem;
padding: 0.4rem 0.75rem; background: var(--mantle);
border-bottom: 1px solid var(--surface0);
}
#toolbar a { color: var(--blue); text-decoration: none; font-size: 0.85rem; }
#toolbar a:hover { text-decoration: underline; }
.tbtn {
padding: 0.15rem 0.5rem; font-size: 0.72rem; font-family: inherit;
background: var(--surface0); color: var(--subtext0);
border: 1px solid var(--surface1); border-radius: 4px; cursor: pointer;
}
.tbtn.active { color: var(--green); border-color: var(--green); }
.tbtn:disabled { opacity: 0.4; cursor: default; }
#status { margin-left: auto; font-size: 0.75rem; color: var(--subtext0); }
#status.connected { color: var(--green); }
#status.error { color: var(--red); }
#debug-log {
position: fixed; bottom: 0; left: 0; right: 0; max-height: 40vh;
overflow-y: auto; background: rgba(17,17,27,0.95);
border-top: 1px solid var(--surface1);
font-size: 0.72rem; font-family: ui-monospace, monospace;
padding: 0.4rem 0.6rem; z-index: 100;
display: none; /* hidden by default; toggled by toolbar button */
}
#debug-log .dbg-line { color: var(--subtext0); margin: 1px 0; white-space: pre; }
#debug-log .dbg-line.err { color: var(--red); }
#debug-log .dbg-line.ok { color: var(--green); }
#debug-log .dbg-line.send { color: var(--blue); }
#canvas-wrap {
display: flex; justify-content: center; align-items: flex-start;
width: 100%; height: calc(100% - 36px); overflow: auto;
background: var(--crust);
}
/* Fit mode: centre the canvas (relayoutCanvas() scales it in JS to
fit the wrap) and clip any sub-pixel rounding overflow. */
#canvas-wrap.fit { align-items: center; overflow: hidden; }
canvas { display: block; cursor: default; }
/* Pin the canvas to exactly the size relayoutCanvas() sets. See
docs/web-ui.md::Per-agent endpoints (GET /screen) for the
flex-item min-width:auto clamp that made fit mode a silent
no-op before this pinning. */
#canvas-wrap.fit canvas { flex: none; min-width: 0; min-height: 0; }
#msg {
position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
background: var(--surface0); color: var(--yellow); border-radius: 6px;
padding: 0.4rem 0.9rem; font-size: 0.8rem;
opacity: 0; transition: opacity 0.3s;
pointer-events: none;
}
</style>
<link rel="stylesheet" href="static/agent.css">
</head>
<body>
<body class="screen-shell">
<div id="toolbar">
<strong>🖥 screen</strong>
<a href="./" title="back to agent page">← agent</a>

View file

@ -11,11 +11,14 @@
--purple: #cba6f7; /* mauve */
--purple-dim: #45475a;/* surface1 */
--cyan: #89dceb; /* sky */
--blue: #89b4fa; /* blue */
--pink: #f5c2e7; /* pink */
--amber: #fab387; /* peach */
--yellow: #f9e2af; /* yellow */
--green: #a6e3a1; /* green */
--red: #f38ba8; /* red */
--border: #313244; /* surface0 */
--subtext0: #a6adc8; /* subtext0 — secondary/toolbar text, dimmer than --fg but lighter than --muted */
}
body {
background: var(--bg);