Skip to content

Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.

Rust
4.2 KB
Raw Blame
/* SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
/* SPDX-License-Identifier: Apache-2.0 */
/* The popup follows macOS menu bar menus: the system font and label colors, the system
   light or dark appearance, the native material behind transparent content, and menu rows
   that highlight with the accent color. AppKit clips the panel to rounded corners, so the
   page itself draws nothing outside #popup. */
:root {
  --label: rgba(0, 0, 0, .85); --secondary: rgba(0, 0, 0, .55); --separator: rgba(0, 0, 0, .1);
  --fill: rgba(0, 0, 0, .05); --opaque: #ECECEC; --success: #1A8B3A; --warning: #B25000; --danger: #C42B1C;
  --bar: #CD744F;
  font: 13px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none; cursor: default;
}
@media (prefers-color-scheme: dark) {
  :root { --label: rgba(255, 255, 255, .88); --secondary: rgba(255, 255, 255, .58); --separator: rgba(255, 255, 255, .12);
    --fill: rgba(255, 255, 255, .07); --opaque: #2C2C2E; --success: #32D74B; --warning: #FF9F0A; --danger: #FF6961; }
}
* { box-sizing: border-box; }
/* A background on html or body would fill the whole rectangular page, so only #popup paints. */
html, body { margin: 0; overflow: hidden; background: transparent; }
#popup { display: flex; flex-direction: column; max-height: 100vh; padding: 5px; border-radius: 12px; color: var(--label); }
/* macOS materials already become opaque with Reduce Transparency. Windows has no material and
   an opaque rectangular window, so the popup fills it. */
:root[data-native-material="false"] #popup { border-radius: 0; background: var(--opaque); }

header { flex-shrink: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 6px 9px 2px; }
header strong { font-weight: 600; }
.connection { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--secondary); white-space: nowrap; }
.connection::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.connection.running::before { background: var(--success); }

main { flex: 0 1 auto; min-height: 0; overflow: auto; padding: 0 9px 4px; color-scheme: light dark; }
p { margin: 0; }
.detail { font-size: 12px; color: var(--secondary); overflow-wrap: anywhere; }
#server-url { margin-bottom: 2px; }
#error { margin: 6px 0; padding: 6px 8px; border-radius: 6px; background: var(--fill); font-size: 12px; color: var(--danger); white-space: pre-line; overflow-wrap: anywhere; }
#empty, #note { margin-top: 8px; }
h2 { margin: 10px 0 2px; font-size: 12px; font-weight: 600; color: var(--secondary); }
.period p { font-variant-numeric: tabular-nums; }
.period p + p { margin-top: 1px; }
.period .saved { color: var(--success); }
.period .detail { overflow-wrap: anywhere; }

#model-list { display: grid; gap: 5px; margin: 4px 0 0; padding: 0; list-style: none; }
#model-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px; }
#model-list .model { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#model-list .share { font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; }
#model-list .track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
#model-list .track i { display: block; height: 100%; border-radius: 2px; background: var(--bar); }

footer { flex-shrink: 0; }
nav { display: grid; padding: 4px 0; }
/* Like menu separators, the line stops short of the rounded edges. */
nav::before { content: ""; height: 1px; margin: 0 9px 4px; background: var(--separator); }
nav:last-child { padding-bottom: 0; }
button { all: unset; display: block; height: 24px; padding: 0 9px; border-radius: 6px; line-height: 24px; color: var(--label); white-space: nowrap; }
button.active:not(:disabled), button:focus-visible:not(:disabled) { background: #0A84FF; background: -apple-system-control-accent; color: #FFFFFF; }
button:focus { outline: none; }
#status:empty { display: none; }
#status { padding: 2px 9px 4px; font-size: 12px; color: var(--secondary); white-space: pre-line; overflow-wrap: anywhere; }