Amber Phosphor Terminal
Warm smoked-charcoal and amber-phosphor GPU terminal showcase with interactive pseudo-shell and frame-time telemetry.
Inspired by Ghostty ↗
WHY THIS AESTHETIC IS UNIQUE
Reinvents the developer terminal aesthetic by ditching tired matrix-green for warm smoked charcoal, tactile amber phosphor accents, and authentic native TUI frame-budget metrics.
BEST FOR
TAGS
COLOR PALETTE (CLICK TO COPY HEX)
TYPOGRAPHY
- Display
- JetBrains Mono
- Body
- IBM Plex Sans
- Mono
- JetBrains Mono
- Scale
- Monospace-led hierarchy with crisp 13-14px terminal buffer text, box-drawing dividers, and restrained 28-36px display headings.
ARCHITECTURE & MOBILE NOTES
LAYOUT
Centered native terminal window frame with macOS/TUI tab bar, interactive command prompt & preset command pills, paired with a real-time Canvas frame-time histogram.
INTERACTION
Click command presets (bench, config, ligatures, keybinds) or type commands directly into the interactive prompt to inspect live terminal output and frame-latency telemetry.
MOBILE
Command preset pills provide zero-typing exploration on 390px mobile with 44px touch targets and wrapped terminal output that never overflows horizontally.
AI AGENT GUARDRAILS
DO
- Use warm smoked charcoal (#121110) and phosphor amber (#E89B3C) instead of harsh #000000/#00FF00
- Make the terminal genuinely interactive with preset commands and keyboard input
- Maintain crisp 1px subtle borders and authentic monospace alignment
DON'T
- Do not add heavy CRT scanline blurs that degrade text legibility
- Do not use purple-blue AI gradients behind terminal windows
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Phosphor — Native GPU-Accelerated Terminal Emulator</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap" rel="stylesheet">
<style>
:root {
--canvas: #121110;
--surface: #1C1A18;
--surface-elev: #24211E;
--ink: #F3ECE1;
--accent: #E89B3C;
--accent-bright: #FFB85C;
--accent-soft: rgba(232, 155, 60, 0.14);
--muted: #8B8275;
--rule: #2E2A26;
--rule-strong: #433D36;
--copper: #C96A42;
--sand: #D9B98B;
--font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
--font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}
*, *::before, *::after {
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
background: var(--canvas);
color: var(--ink);
font-family: var(--font-sans);
line-height: 1.5;
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
}
/* Subtle warm radial ambient glow */
body::before {
content: "";
position: fixed;
top: -180px;
left: 50%;
transform: translateX(-50%);
width: 900px;
height: 420px;
background: radial-gradient(ellipse at center, rgba(232, 155, 60, 0.08) 0%, transparent 70%);
pointer-events: none;
z-index: 0;
}
/* TUI Top Chrome */
.tui-nav {
position: sticky;
top: 0;
z-index: 40;
background: rgba(18, 17, 16, 0.92);
backdrop-filter: blur(10px);
border-bottom: 1px solid var(--rule);
}
.tui-nav-inner {
max-width: 1240px;
margin: 0 auto;
padding: 0.75rem 1.25rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
}
.brand {
display: flex;
align-items: center;
gap: 0.65rem;
text-decoration: none;
color: var(--ink);
font-family: var(--font-mono);
font-weight: 700;
font-size: 1rem;
letter-spacing: 0.02em;
}
.brand-glyph {
width: 30px;
height: 30px;
border-radius: 6px;
background: var(--surface-elev);
border: 1px solid var(--rule-strong);
display: grid;
place-items: center;
color: var(--accent);
box-shadow: 0 0 14px rgba(232, 155, 60, 0.16);
}
.nav-links {
display: flex;
align-items: center;
gap: 1.5rem;
font-family: var(--font-mono);
font-size: 0.8rem;
}
.nav-links a {
color: var(--muted);
text-decoration: none;
transition: color 0.15s;
}
.nav-links a:hover,
.nav-links a.active {
color: var(--accent);
}
.ver-pill {
font-family: var(--font-mono);
font-size: 0.72rem;
color: var(--accent);
background: var(--accent-soft);
border: 1px solid rgba(232, 155, 60, 0.35);
padding: 0.3rem 0.65rem;
border-radius: 4px;
white-space: nowrap;
}
.mob-btn {
display: none;
align-items: center;
justify-content: center;
min-width: 44px;
min-height: 44px;
background: var(--surface);
border: 1px solid var(--rule-strong);
border-radius: 5px;
color: var(--ink);
cursor: pointer;
}
.mob-drawer {
display: none;
background: var(--surface);
border-top: 1px solid var(--rule);
padding: 0.5rem 1.25rem 0.9rem;
}
.mob-drawer.open {
display: block;
}
.mob-drawer a {
display: flex;
align-items: center;
min-height: 44px;
color: var(--ink);
text-decoration: none;
font-family: var(--font-mono);
font-size: 0.85rem;
border-bottom: 1px solid var(--rule);
}
.mob-drawer a:last-child {
border-bottom: none;
}
/* Main Layout */
.main-wrap {
position: relative;
z-index: 1;
max-width: 1240px;
margin: 0 auto;
padding: 1.8rem 1.25rem 3.2rem;
}
.hero {
max-width: 780px;
margin-bottom: 1.75rem;
}
.hero-tag {
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--accent);
letter-spacing: 0.06em;
text-transform: uppercase;
margin: 0 0 0.5rem;
}
h1 {
font-family: var(--font-mono);
font-size: clamp(1.65rem, 3.6vw, 2.55rem);
font-weight: 700;
line-height: 1.15;
letter-spacing: -0.02em;
margin: 0 0 0.7rem;
color: var(--ink);
}
h1 span {
color: var(--accent);
text-shadow: 0 0 22px rgba(232, 155, 60, 0.28);
}
.hero-lead {
margin: 0;
color: var(--muted);
font-size: 0.98rem;
}
/* Primary Split: Live Terminal + Frame-Time Telemetry */
.stage-grid {
display: grid;
grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
gap: 1.25rem;
align-items: stretch;
}
/* Native Terminal Emulator Window */
.term-window {
background: var(--surface);
border: 1px solid var(--rule-strong);
border-radius: 8px;
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}
.term-titlebar {
background: var(--surface-elev);
border-bottom: 1px solid var(--rule);
padding: 0.55rem 0.9rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.75rem;
}
.traffic-dots {
display: inline-flex;
gap: 6px;
}
.traffic-dots span {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--rule-strong);
}
.traffic-dots span:first-child {
background: var(--copper);
}
.traffic-dots span:nth-child(2) {
background: var(--accent);
}
.term-title {
font-family: var(--font-mono);
font-size: 0.74rem;
color: var(--muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.term-fps {
font-family: var(--font-mono);
font-size: 0.7rem;
color: var(--accent);
}
/* Quick Command Switcher Bar */
.cmd-bar {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
padding: 0.6rem 0.85rem;
background: rgba(18, 17, 16, 0.55);
border-bottom: 1px solid var(--rule);
}
.cmd-chip {
min-height: 36px;
padding: 0 0.75rem;
background: var(--surface);
border: 1px solid var(--rule-strong);
border-radius: 4px;
color: var(--ink);
font-family: var(--font-mono);
font-size: 0.75rem;
cursor: pointer;
transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.cmd-chip:hover,
.cmd-chip.active {
border-color: var(--accent);
background: var(--accent-soft);
color: var(--accent-bright);
}
/* Terminal Output Viewport */
.term-body {
flex: 1;
min-height: 310px;
max-height: 380px;
overflow-y: auto;
padding: 1rem 1.05rem;
font-family: var(--font-mono);
font-size: 0.8rem;
line-height: 1.55;
color: var(--ink);
}
.term-line {
margin: 0 0 0.22rem;
white-space: pre-wrap;
word-break: break-word;
}
.c-amber { color: var(--accent); }
.c-bright { color: var(--accent-bright); font-weight: 600; }
.c-muted { color: var(--muted); }
.c-copper { color: var(--copper); }
.c-sand { color: var(--sand); }
/* Interactive Command Input */
.term-input-row {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.65rem 0.9rem;
background: #161412;
border-top: 1px solid var(--rule);
}
.prompt-sig {
font-family: var(--font-mono);
font-size: 0.82rem;
color: var(--accent);
font-weight: 700;
white-space: nowrap;
}
.term-input {
flex: 1;
min-width: 0;
min-height: 36px;
background: transparent;
border: none;
color: var(--ink);
font-family: var(--font-mono);
font-size: 0.84rem;
outline: none;
}
.term-input::placeholder {
color: var(--muted);
}
.run-btn {
min-height: 36px;
padding: 0 0.8rem;
background: var(--accent);
color: #121110;
border: none;
border-radius: 4px;
font-family: var(--font-mono);
font-size: 0.74rem;
font-weight: 700;
cursor: pointer;
}
/* GPU Frame-Time Telemetry Panel */
.telemetry-card {
background: var(--surface);
border: 1px solid var(--rule-strong);
border-radius: 8px;
padding: 1.05rem 1.15rem;
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 1rem;
}
.tui-box-head {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 0.6rem;
border-bottom: 1px dashed var(--rule-strong);
}
.tui-box-head h2 {
margin: 0;
font-family: var(--font-mono);
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--accent);
}
.telemetry-metrics {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.55rem;
}
.metric-cell {
background: var(--canvas);
border: 1px solid var(--rule);
border-radius: 5px;
padding: 0.55rem 0.65rem;
}
.metric-label {
display: block;
font-family: var(--font-mono);
font-size: 0.64rem;
color: var(--muted);
text-transform: uppercase;
}
.metric-val {
font-family: var(--font-mono);
font-size: 0.98rem;
font-weight: 700;
color: var(--ink);
}
.metric-val.amber {
color: var(--accent);
}
.canvas-frame {
background: var(--canvas);
border: 1px solid var(--rule);
border-radius: 5px;
padding: 0.65rem;
}
.canvas-caption {
display: flex;
justify-content: space-between;
font-family: var(--font-mono);
font-size: 0.66rem;
color: var(--muted);
margin-bottom: 0.4rem;
}
#frameCanvas {
display: block;
width: 100%;
height: 168px;
}
.load-controls {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.45rem;
}
.load-btn {
min-height: 44px;
padding: 0 0.4rem;
background: var(--canvas);
border: 1px solid var(--rule-strong);
border-radius: 4px;
color: var(--muted);
font-family: var(--font-mono);
font-size: 0.72rem;
font-weight: 600;
cursor: pointer;
}
.load-btn.active {
border-color: var(--accent);
background: var(--accent-soft);
color: var(--accent-bright);
}
/* Architecture Strip */
.arch-grid {
margin-top: 1.5rem;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
}
.arch-card {
background: var(--surface);
border: 1px solid var(--rule);
border-radius: 6px;
padding: 1.05rem 1.15rem;
}
.arch-card .tui-prefix {
font-family: var(--font-mono);
font-size: 0.7rem;
color: var(--accent);
margin-bottom: 0.35rem;
display: block;
}
.arch-card h3 {
margin: 0 0 0.35rem;
font-family: var(--font-mono);
font-size: 0.95rem;
color: var(--ink);
}
.arch-card p {
margin: 0;
font-size: 0.84rem;
color: var(--muted);
}
@media (max-width: 960px) {
.stage-grid {
grid-template-columns: 1fr;
}
.arch-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 700px) {
.nav-links, .ver-pill {
display: none;
}
.mob-btn {
display: inline-flex;
}
.main-wrap {
padding: 1.15rem 0.85rem 2.5rem;
}
.cmd-chip {
min-height: 44px;
padding: 0 0.75rem;
}
.run-btn {
min-height: 44px;
}
.term-body {
font-size: 0.74rem;
}
}
</style>
</head>
<body>
<header class="tui-nav">
<div class="tui-nav-inner">
<a href="#shell" class="brand">
<span class="brand-glyph">>_</span>
<span>phosphor</span>
</a>
<nav class="nav-links" aria-label="Primary">
<a href="#shell" class="active">live-shell</a>
<a href="#telemetry">frame-histogram</a>
<a href="#arch">architecture</a>
</nav>
<span class="ver-pill">v1.2.0 · Metal / OpenGL 4.6</span>
<button class="mob-btn" id="mobBtn" type="button" aria-expanded="false" aria-controls="mobDrawer" aria-label="Toggle navigation">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8">
<path d="M3 5h14M3 10h14M3 15h14"/>
</svg>
</button>
</div>
<div class="mob-drawer" id="mobDrawer">
<a href="#shell">live-shell</a>
<a href="#telemetry">frame-histogram</a>
<a href="#arch">architecture</a>
</div>
</header>
<main class="main-wrap">
<section class="hero">
<p class="hero-tag">┌─ Native GPU Terminal · Zig + Metal / OpenGL · Sub-Millisecond Input ─┐</p>
<h1>Warm phosphor clarity at <span>120 FPS</span> native speed.</h1>
<p class="hero-lead">Zero Electron overhead. Platform-native window chrome, HarfBuzz ligature shaping, and a lock-free IO reader thread that drains multi-gigabyte stdout streams without dropping a frame.</p>
</section>
<section class="stage-grid">
<!-- Interactive Live Pseudo-Shell -->
<div class="term-window" id="shell">
<div class="term-titlebar">
<span class="traffic-dots" aria-hidden="true"><span></span><span></span><span></span></span>
<span class="term-title">phosphor — zsh — 112×32 — Metal GPU</span>
<span class="term-fps" id="termFpsBadge">120 Hz</span>
</div>
<div class="cmd-bar" role="group" aria-label="Preset terminal commands">
<button class="cmd-chip active" type="button" data-cmd="bench">bench</button>
<button class="cmd-chip" type="button" data-cmd="config">config</button>
<button class="cmd-chip" type="button" data-cmd="ligatures">ligatures</button>
<button class="cmd-chip" type="button" data-cmd="keybinds">keybinds</button>
<button class="cmd-chip" type="button" data-cmd="clear">clear</button>
</div>
<div class="term-body" id="termBody" aria-live="polite"></div>
<form class="term-input-row" id="termForm" autocomplete="off">
<span class="prompt-sig">~/dev ❯</span>
<input class="term-input" id="termInput" type="text" placeholder="Type bench, config, ligatures, keybinds, or help..." aria-label="Terminal command input">
<button class="run-btn" type="submit">RUN</button>
</form>
</div>
<!-- Real-Time Frame-Time Canvas Histogram -->
<aside class="telemetry-card" id="telemetry">
<div>
<div class="tui-box-head">
<h2>GPU Frame-Time Histogram</h2>
<span style="font-family:var(--font-mono);font-size:0.7rem;color:var(--muted)" id="modeLabel">IDLE 120HZ</span>
</div>
<div class="telemetry-metrics" style="margin-top:0.85rem;">
<div class="metric-cell">
<span class="metric-label">p50 Frame</span>
<span class="metric-val amber" id="p50Val">1.42 ms</span>
</div>
<div class="metric-cell">
<span class="metric-label">p99 Frame</span>
<span class="metric-val" id="p99Val">2.84 ms</span>
</div>
<div class="metric-cell">
<span class="metric-label">Draw Calls</span>
<span class="metric-val" id="drawVal">3 / frame</span>
</div>
</div>
</div>
<div class="canvas-frame">
<div class="canvas-caption">
<span>FRAME TIME (MS) · LAST 48 FRAMES</span>
<span style="color:var(--copper)">— 8.33ms BUDGET</span>
</div>
<canvas id="frameCanvas" width="440" height="168" aria-label="Real-time GPU frame time histogram"></canvas>
</div>
<div>
<div style="font-family:var(--font-mono);font-size:0.68rem;color:var(--muted);margin-bottom:0.45rem;">SIMULATE TERMINAL WORKLOAD</div>
<div class="load-controls" role="group" aria-label="Telemetry workload mode">
<button class="load-btn active" type="button" data-load="idle">Idle 120Hz</button>
<button class="load-btn" type="button" data-load="burst">Scroll Burst</button>
<button class="load-btn" type="button" data-load="pause">Pause</button>
</div>
</div>
</aside>
</section>
<section class="arch-grid" id="arch">
<article class="arch-card">
<span class="tui-prefix">[01] RENDERER</span>
<h3>Instanced Glyph Atlas</h3>
<p>Every visible cell renders in 3 instanced GPU draw calls: background quads, monochrome/color glyph sprites, and undercurl overlays.</p>
</article>
<article class="arch-card">
<span class="tui-prefix">[02] VT ENGINE</span>
<h3>SIMD Escape Parser</h3>
<p>Vectorized UTF-8 and CSI/OSC state machine parses raw PTY output at over 1.8 GB/s with zero heap allocations on the hot path.</p>
</article>
<article class="arch-card">
<span class="tui-prefix">[03] PLATFORM</span>
<h3>Native AppKit & GTK4</h3>
<p>First-class OS tabs, splits, IME composition, and Quick Terminal dropdowns built directly against native platform APIs.</p>
</article>
</section>
</main>
<script>
const COMMAND_OUTPUTS = {
bench: [
{ cls: "c-amber", text: "┌─ phosphor +bench ── PTY Throughput & Frame Pacing ───────────────┐" },
{ cls: "c-ink", text: "│ seq 1 5000000 (stdout drain) 184 ms [1.92 GB/s SIMD VT] │" },
{ cls: "c-ink", text: "│ 24-bit Truecolor RGB scroll 1.68 ms [p99 @ 120Hz Metal] │" },
{ cls: "c-ink", text: "│ Key-to-Photon Input Latency 2.10 ms [Direct CoreText] │" },
{ cls: "c-sand", text: "│ Cold Startup to First Prompt 19.4 ms [Zero JS Runtime] │" },
{ cls: "c-amber", text: "└──────────────────────────────────────────────────────────────────┘" }
],
config: [
{ cls: "c-muted", text: "# ~/.config/phosphor/config (hot-reloaded on save)" },
{ cls: "c-sand", text: "font-family = \"JetBrains Mono\"" },
{ cls: "c-sand", text: "font-size = 13.5" },
{ cls: "c-amber", text: "theme = \"amber-phosphor\"" },
{ cls: "c-ink", text: "background = #121110" },
{ cls: "c-ink", text: "foreground = #F3ECE1" },
{ cls: "c-amber", text: "cursor-color = #E89B3C" },
{ cls: "c-ink", text: "window-padding-x = 12" },
{ cls: "c-muted", text: "macos-titlebar-style = tabs" }
],
ligatures: [
{ cls: "c-amber", text: "HarfBuzz OpenType Shaping · Active Features: +calt +liga +ss01" },
{ cls: "c-bright",text: " Arrows & Pipes: -> => <=> |> <| <-- ==> ::=" },
{ cls: "c-sand", text: " Comparisons: != !== === <= >= <> ~= :=" },
{ cls: "c-ink", text: " Box Drawing: ┌──┬──┐ ├──┼──┤ └──┴──┘ █▓▒░" },
{ cls: "c-muted", text: " Status: Pixel-aligned geometric box glyphs rendered via shader." }
],
keybinds: [
{ cls: "c-amber", text: "ACTIVE KEYBINDINGS (super = Cmd / Ctrl+Shift)" },
{ cls: "c-ink", text: " super+d new_split:right" },
{ cls: "c-ink", text: " super+shift+d new_split:down" },
{ cls: "c-ink", text: " super+enter toggle_split_zoom" },
{ cls: "c-ink", text: " super+shift+comma reload_config" },
{ cls: "c-sand", text: " ctrl+grave toggle_quick_terminal" }
],
help: [
{ cls: "c-amber", text: "Available interactive commands:" },
{ cls: "c-ink", text: " bench Run PTY throughput & Metal frame pacing benchmark" },
{ cls: "c-ink", text: " config Print active ~/.config/phosphor/config" },
{ cls: "c-ink", text: " ligatures Inspect HarfBuzz ligatures & shader box-drawing" },
{ cls: "c-ink", text: " keybinds List native split & quick-terminal bindings" },
{ cls: "c-ink", text: " clear Clear terminal scrollback" }
]
};
const termBody = document.getElementById("termBody");
function appendLine(text, cls = "") {
const div = document.createElement("div");
div.className = "term-line " + cls;
div.textContent = text;
termBody.appendChild(div);
}
function runCommand(rawCmd) {
const cmd = rawCmd.trim().toLowerCase();
if (!cmd) return;
document.querySelectorAll(".cmd-chip").forEach(chip => {
chip.classList.toggle("active", chip.dataset.cmd === cmd);
});
if (cmd === "clear") {
termBody.innerHTML = "";
appendLine("phosphor v1.2.0 — scrollback cleared. Type 'help' or tap a preset above.", "c-muted");
return;
}
appendLine(`~/dev ❯ phosphor ${cmd}`, "c-bright");
if (COMMAND_OUTPUTS[cmd]) {
COMMAND_OUTPUTS[cmd].forEach(line => appendLine(line.text, line.cls));
} else {
appendLine(`zsh: command not found: ${cmd}. Try: bench, config, ligatures, keybinds, help`, "c-copper");
}
appendLine("", "");
termBody.scrollTop = termBody.scrollHeight;
}
document.querySelectorAll(".cmd-chip").forEach(btn => {
btn.addEventListener("click", () => runCommand(btn.dataset.cmd));
});
document.getElementById("termForm").addEventListener("submit", e => {
e.preventDefault();
const input = document.getElementById("termInput");
runCommand(input.value);
input.value = "";
});
// Initial boot output
runCommand("bench");
// Real-Time Frame-Time Canvas 2D Histogram
const canvas = document.getElementById("frameCanvas");
const ctx = canvas.getContext("2d");
const SAMPLE_COUNT = 48;
const samples = Array.from({ length: SAMPLE_COUNT }, () => 1.2 + Math.random() * 0.9);
let loadMode = "idle";
function pushSample() {
if (loadMode === "pause") return;
let nextVal;
if (loadMode === "burst") {
nextVal = 3.2 + Math.random() * 3.4 + (Math.random() > 0.88 ? 1.4 : 0);
} else {
nextVal = 1.15 + Math.random() * 0.95 + (Math.random() > 0.92 ? 0.65 : 0);
}
samples.shift();
samples.push(nextVal);
}
function drawHistogram() {
const w = canvas.width;
const h = canvas.height;
ctx.clearRect(0, 0, w, h);
const maxMs = 10;
const padB = 18;
const plotH = h - padB - 8;
// Subtle horizontal guide lines
ctx.strokeStyle = "#2A2622";
ctx.lineWidth = 1;
[2.5, 5.0, 7.5].forEach(ms => {
const y = h - padB - (ms / maxMs) * plotH;
ctx.beginPath();
ctx.moveTo(0, y);
ctx.lineTo(w, y);
ctx.stroke();
});
// 8.33ms 120Hz budget line
const budgetY = h - padB - (8.33 / maxMs) * plotH;
ctx.save();
ctx.strokeStyle = "#C96A42";
ctx.setLineDash([4, 4]);
ctx.beginPath();
ctx.moveTo(0, budgetY);
ctx.lineTo(w, budgetY);
ctx.stroke();
ctx.restore();
// Bars
const slotW = w / SAMPLE_COUNT;
const barW = Math.max(3, slotW - 2.5);
samples.forEach((val, idx) => {
const clamped = Math.min(val, maxMs);
const barH = (clamped / maxMs) * plotH;
const x = idx * slotW + 1;
const y = h - padB - barH;
ctx.fillStyle = val > 6.5 ? "#C96A42" : (idx === SAMPLE_COUNT - 1 ? "#FFB85C" : "#E89B3C");
ctx.fillRect(x, y, barW, barH);
});
// Baseline labels
ctx.fillStyle = "#8B8275";
ctx.font = "10px 'JetBrains Mono', monospace";
ctx.fillText("0ms", 2, h - 4);
ctx.fillText("4ms", w * 0.45, h - 4);
ctx.fillText("120Hz target", w - 76, h - 4);
// Update numeric readouts
const sorted = [...samples].sort((a, b) => a - b);
const p50 = sorted[Math.floor(sorted.length * 0.5)];
const p99 = sorted[Math.floor(sorted.length * 0.96)];
document.getElementById("p50Val").textContent = `${p50.toFixed(2)} ms`;
document.getElementById("p99Val").textContent = `${p99.toFixed(2)} ms`;
document.getElementById("drawVal").textContent = loadMode === "burst" ? "4 / frame" : "3 / frame";
}
setInterval(() => {
pushSample();
drawHistogram();
}, 240);
drawHistogram();
document.querySelectorAll(".load-btn").forEach(btn => {
btn.addEventListener("click", () => {
loadMode = btn.dataset.load;
document.querySelectorAll(".load-btn").forEach(b => b.classList.toggle("active", b === btn));
const map = { idle: "IDLE 120HZ", burst: "STDOUT BURST", pause: "PAUSED" };
document.getElementById("modeLabel").textContent = map[loadMode];
});
});
// Mobile drawer
const mobBtn = document.getElementById("mobBtn");
const mobDrawer = document.getElementById("mobDrawer");
mobBtn.addEventListener("click", () => {
const open = mobDrawer.classList.toggle("open");
mobBtn.setAttribute("aria-expanded", String(open));
});
</script>
</body>
</html>