Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ios-palette-web.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ftw": patch
---

The box's dashboard now uses the phone app's colours. The grid is one pink colour both ways, and the sign and the word say whether you buy or sell. The battery is cyan when it stores power and orange when it gives power, and the car is violet. Green now only means live or confirmed, and red only means refused, failed or blocked. Prices are shades of ink, not red and green.
91 changes: 41 additions & 50 deletions web/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ body.ftw-app .icon-btn:hover {
}
body.ftw-app .icon-btn[aria-pressed="true"] {
color: var(--fg);
background: oklch(0.3 0.1 var(--accent-hue) / 0.2);
background: color-mix(in oklab, var(--accent-e) 12%, transparent);
border-color: var(--accent-e);
}
body.ftw-app .icon-btn[aria-pressed="true"]:hover {
Expand Down Expand Up @@ -346,7 +346,7 @@ body.ftw-app #overview-cars[hidden] {
display: none !important;
}
body.ftw-app .overview-cars-age {
color: var(--amber);
color: var(--fg-dim);
font-family: var(--mono);
font-size: 11px;
}
Expand Down Expand Up @@ -434,15 +434,15 @@ body.ftw-app .overview-health-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--red-e);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--red-e) 14%, transparent);
background: var(--alarm);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--alarm) 14%, transparent);
}
body.ftw-app .overview-health.is-connected {
color: var(--fg-dim);
}
body.ftw-app .overview-health.is-connected .overview-health-dot {
background: var(--green-e);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--green-e) 14%, transparent);
background: var(--live);
box-shadow: 0 0 0 3px color-mix(in oklch, var(--live) 14%, transparent);
}
body.ftw-app .section-kicker {
margin: 0 0 3px;
Expand Down Expand Up @@ -746,10 +746,10 @@ body.ftw-app .val-import { color: var(--red-e); }
body.ftw-app .val-export { color: var(--green-e); }
body.ftw-app .val-generation { color: var(--amber); }
body.ftw-app .val-charging { color: var(--cyan); }
body.ftw-app .val-discharging { color: var(--cyan-dim); }
body.ftw-app .val-discharging { color: var(--energy-gives); }
body.ftw-app .val-neutral { color: var(--fg); }
body.ftw-app .val-ev-charging { color: var(--green-e); }
body.ftw-app .val-ev-connected{ color: var(--amber); }
body.ftw-app .val-ev-charging { color: var(--violet); }
body.ftw-app .val-ev-connected{ color: var(--fg-dim); }

/* Fuse — own row, one box per phase. */
body.ftw-app .fuse-row {
Expand Down Expand Up @@ -814,7 +814,7 @@ body.ftw-app .fuse-phase-col .fuse-phase-w {
padding: 0 4px;
}
body.ftw-app .fuse-phase-col .fuse-phase-w.export {
color: var(--cyan);
color: var(--green-e);
}
body.ftw-app .fuse-phase-box .fuse-phase-label {
font-family: var(--mono);
Expand Down Expand Up @@ -857,11 +857,9 @@ body.ftw-app .fuse-fill {
background: var(--green-e);
transition: width 0.3s, background 0.3s;
}
body.ftw-app .fuse-phase-fill.warn,
body.ftw-app .fuse-fill.warn { background: var(--amber); }
body.ftw-app .fuse-phase-fill.crit,
body.ftw-app .fuse-fill.crit { background: var(--red-e); }
body.ftw-app .fuse-phase-fill.export { background: var(--cyan); }
body.ftw-app .fuse-fill.crit { background: var(--alarm); }
body.ftw-app .fuse-phase-fill.export { background: var(--green-e); }
body.ftw-app .fuse-bar {
/* Fallback single-bar track (used when the site meter doesn't
report per-phase amperage). Same theme-aware background as the
Expand Down Expand Up @@ -1012,7 +1010,7 @@ body.ftw-app .history-toggle button {
cursor: pointer;
transition: color 220ms ease;
}
body.ftw-app .history-toggle button.active { color: #0a0a0a; }
body.ftw-app .history-toggle button.active { color: var(--on-accent); }
body.ftw-app .history-toggle button:not(.active):hover { color: var(--fg); }
body.ftw-app .history-toggle button:focus-visible {
outline: 1px solid var(--accent-e);
Expand Down Expand Up @@ -1167,7 +1165,7 @@ body.ftw-app .mode-buttons button:hover {
color: var(--fg);
}
body.ftw-app .mode-buttons button.active {
background: oklch(0.3 0.1 var(--accent-hue) / 0.25);
background: color-mix(in oklab, var(--accent-e) 14%, transparent);
border-color: var(--accent-e);
color: var(--fg);
}
Expand Down Expand Up @@ -1228,7 +1226,7 @@ body.ftw-app .plan-style-steps button:hover {
color: var(--fg);
}
body.ftw-app .plan-style-steps button[aria-checked="true"] {
background: oklch(0.3 0.1 var(--accent-hue) / 0.35);
background: color-mix(in oklab, var(--accent-e) 18%, transparent);
box-shadow: inset 0 0 0 1px var(--accent-e);
color: var(--fg);
}
Expand Down Expand Up @@ -1271,7 +1269,7 @@ body.ftw-app .plan-style-note .btn-link {
font-size: 13px;
}
body.ftw-app .plan-style-status {
color: var(--red-e);
color: var(--alarm);
}
/* The numbers describe the plan that is still running until the new one
lands, so they step back while the box replans. */
Expand Down Expand Up @@ -1465,8 +1463,7 @@ body.ftw-app .plan-horizon button {
body.ftw-app .plan-horizon button:hover { color: var(--fg); }
body.ftw-app .plan-horizon button.active {
background: var(--accent-e);
/* On-accent text is near-black per the shared design system, never white. */
color: #0a0a0a;
color: var(--on-accent);
}

body.ftw-app .chart-title-row {
Expand Down Expand Up @@ -1637,8 +1634,8 @@ body.ftw-app .live-stat-value {
}
body.ftw-app .live-stat-value.is-import { color: var(--red-e); }
body.ftw-app .live-stat-value.is-export { color: var(--green-e); }
body.ftw-app .live-stat-value.is-charging { color: var(--accent-e); }
body.ftw-app .live-stat-value.is-discharging { color: var(--blue-e, #60a5fa); }
body.ftw-app .live-stat-value.is-charging { color: var(--cyan); }
body.ftw-app .live-stat-value.is-discharging { color: var(--energy-gives); }
body.ftw-app .live-stat-value.is-neutral { color: var(--fg-dim); }

/* 24 h battery + SoC history block — sits below the live power chart.
Expand Down Expand Up @@ -1686,12 +1683,9 @@ body.ftw-app .range-buttons button:not(.active):hover {
border-color: var(--fg-dim);
}
body.ftw-app .range-buttons button.active {
/* On-accent text per the shared design system is near-black, not white — so the
amber ON state is readable in both themes and stops looking
washed-out in light mode where the old oklch(0.15 …) barely
differed from pure black. */
/* The ON state is ink with --on-accent text, so it reads in both themes. */
background: var(--accent-e);
color: #0a0a0a;
color: var(--on-accent);
border-color: var(--accent-e);
font-weight: 600;
}
Expand Down Expand Up @@ -1831,8 +1825,8 @@ body.ftw-app .plan-state-badge {
text-transform: uppercase;
}
body.ftw-app .plan-state-badge.is-active {
border-color: color-mix(in oklch, var(--green-e) 55%, var(--line));
color: var(--green-e);
border-color: color-mix(in oklab, var(--live) 55%, var(--line));
color: var(--live);
}
body.ftw-app .plan-state-badge.is-warn {
border-color: color-mix(in oklch, var(--accent-e) 60%, var(--line));
Expand Down Expand Up @@ -2204,20 +2198,20 @@ body.ftw-app .btn-add:disabled {
opacity: 0.75;
}
body.ftw-app .btn-remove {
color: var(--red-e);
color: var(--alarm);
flex: 0 0 auto;
}
body.ftw-app .btn-remove:hover {
background: transparent;
border-color: var(--red-e);
border-color: var(--alarm);
}
body.ftw-app .settings-status {
color: var(--fg-muted);
font-family: var(--mono);
}
body.ftw-app .settings-status.success { color: var(--green-e); }
body.ftw-app .settings-status.warning { color: var(--amber); }
body.ftw-app .settings-status.error { color: var(--red-e); }
body.ftw-app .settings-status.success { color: var(--live); }
body.ftw-app .settings-status.warning { color: var(--alarm); }
body.ftw-app .settings-status.error { color: var(--alarm); }
body.ftw-app .creds-badge {
border-radius: 999px;
font-family: var(--mono);
Expand All @@ -2226,9 +2220,9 @@ body.ftw-app .creds-badge {
text-transform: uppercase;
}
body.ftw-app .creds-badge.creds-saved {
background: color-mix(in srgb, var(--green-e) 10%, transparent);
border-color: color-mix(in srgb, var(--green-e) 35%, transparent);
color: var(--green-e);
background: color-mix(in srgb, var(--live) 10%, transparent);
border-color: color-mix(in srgb, var(--live) 35%, transparent);
color: var(--live);
}
body.ftw-app .creds-badge.creds-missing {
background: color-mix(in srgb, var(--accent-e) 10%, transparent);
Expand Down Expand Up @@ -2347,8 +2341,8 @@ body.ftw-app .drv-catalog-tag {
/* Four of thirty-seven have run on customer hardware. That is the difference
worth showing, so it is the only tag that carries colour. */
body.ftw-app .drv-catalog-proven {
border-color: color-mix(in srgb, var(--green-e) 40%, transparent);
color: var(--green-e);
border-color: color-mix(in srgb, var(--live) 40%, transparent);
color: var(--live);
}
body.ftw-app .drv-catalog-unproven {
border-color: color-mix(in srgb, var(--accent-e) 30%, transparent);
Expand Down Expand Up @@ -2449,10 +2443,10 @@ body.ftw-app .drv-editor-problem {
text-align: left;
}
body.ftw-app .drv-editor-problem:hover { color: var(--fg); }
body.ftw-app .drv-editor-error { border-left-color: var(--red-e); }
body.ftw-app .drv-editor-error { border-left-color: var(--alarm); }
body.ftw-app .drv-editor-warning { border-left-color: var(--accent-e); }
body.ftw-app .drv-editor-clean {
color: var(--green-e);
color: var(--live);
font-family: var(--mono);
font-size: 0.72rem;
}
Expand Down Expand Up @@ -2508,10 +2502,10 @@ body.ftw-app .driver-test-status {
font-size: 0.75rem;
}
body.ftw-app .driver-test-status.ok {
color: var(--green-e);
color: var(--live);
}
body.ftw-app .driver-test-status.error {
color: var(--red-e);
color: var(--alarm);
}
body.ftw-app .driver-test-output {
background: var(--ink-sunken);
Expand Down Expand Up @@ -2565,10 +2559,10 @@ body.ftw-app .v2x-command-status {
min-height: 1em;
}
body.ftw-app .v2x-command-status.ok {
color: var(--green-e);
color: var(--live);
}
body.ftw-app .v2x-command-status.error {
color: var(--red-e);
color: var(--alarm);
}
@media (max-width: 720px) {
body.ftw-app .v2x-control-panel {
Expand Down Expand Up @@ -2642,7 +2636,7 @@ body.ftw-app .driver-test-empty {
font-size: 0.78rem;
}
body.ftw-app .driver-test-error {
color: var(--red-e);
color: var(--alarm);
margin-top: 8px;
}

Expand Down Expand Up @@ -2985,9 +2979,6 @@ html[data-theme="light"] body.ftw-app > header .icon-btn,
html[data-theme="light"] body.ftw-app > header .settings-btn {
color: var(--fg);
}
html[data-theme="light"] body.ftw-app .mode-buttons button.active {
background: oklch(0.75 0.14 var(--accent-hue) / 0.25);
}
html[data-theme="light"] body.ftw-app .status-bar {
background: var(--ink-sunken);
}
Expand Down Expand Up @@ -3072,7 +3063,7 @@ body.ftw-app .twin-profile-toggle button {

body.ftw-app .twin-profile-toggle button.active {
background: var(--accent-e);
color: #0a0a0a;
color: var(--on-accent);
}

body.ftw-app .twin-profile-toggle button:not(.active):hover {
Expand Down
34 changes: 7 additions & 27 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,31 +319,11 @@
return Math.round(w) + " W";
}

// Fuse bar color — smooth green→yellow→orange→red gradient across
// 0 %→100 %. Anchors land at the named color at each zone
// boundary: 0 %=green, 50 %=yellow, 75 %=orange, 90 %+=red. Between
// them the hue interpolates linearly so a bar at 45 % already reads
// yellow-leaning (h ≈ 100, close to yellow's 95), not solid green —
// matches the "45 % is more towards yellow than green" spec. Oklch
// holds lightness + chroma constant so the transitions don't muddy.
// Fuse bar color. The bar is grid power, so it takes the grid colour, as
// on the phone; from 90 % it takes the alarm, because operators just need
// to see "DANGER" there.
function fuseFillColor(pct) {
var c = Math.max(0, Math.min(100, pct));
var h;
if (c < 50) {
// 0 → 50 : 150 (green) → 95 (yellow)
h = 150 - (c / 50) * (150 - 95);
} else if (c < 75) {
// 50 → 75 : 95 (yellow) → 50 (orange)
h = 95 - ((c - 50) / 25) * (95 - 50);
} else if (c < 90) {
// 75 → 90 : 50 (orange) → 22 (red)
h = 50 - ((c - 75) / 15) * (50 - 22);
} else {
// 90 → 100: solid red. Saturate rather than continue shifting
// hue — operators just need to see "DANGER", not a hue delta.
h = 22;
}
return "oklch(0.78 0.18 " + h.toFixed(1) + ")";
return pct >= 90 ? "var(--alarm)" : "var(--red-e)";
}

// Snap an axis range to "nice" round numbers. Returns { min, max, step }
Expand Down Expand Up @@ -3442,7 +3422,7 @@
startBtn.style.cursor = "pointer";
startBtn.style.fontWeight = "600";
startBtn.style.background = "var(--accent-e)";
startBtn.style.color = "#0a0a0a";
startBtn.style.color = "var(--on-accent)";
function renderStartLabel() { startBtn.textContent = "Boost for " + dur.options[dur.selectedIndex].textContent; }
renderStartLabel();
dur.addEventListener("change", renderStartLabel);
Expand Down Expand Up @@ -3692,7 +3672,7 @@
startBtn.style.cursor = "pointer";
startBtn.style.fontWeight = "600";
startBtn.style.background = "var(--accent-e)";
startBtn.style.color = "#0a0a0a";
startBtn.style.color = "var(--on-accent)";

var stopBtn = document.createElement("button");
stopBtn.type = "button";
Expand Down Expand Up @@ -4376,7 +4356,7 @@
dayChips.forEach(function (chip) {
chip.setAttribute("aria-pressed", chip.on ? "true" : "false");
chip.style.background = chip.on ? "var(--accent-e)" : "transparent";
chip.style.color = chip.on ? "#0a0a0a" : "var(--text-dim)";
chip.style.color = chip.on ? "var(--on-accent)" : "var(--text-dim)";
chip.style.borderColor = chip.on ? "var(--accent-e)" : "var(--line)";
});
}
Expand Down
6 changes: 3 additions & 3 deletions web/car-soc-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,16 @@ function styles(doc) {
.car-soc-history header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px;border-bottom:1px solid var(--line)}
.car-soc-history h2{font-size:1.1rem;margin:0}.car-soc-history h3{font-size:.95rem;margin:0}
.car-soc-history button{font:inherit;color:var(--fg);border:1px solid var(--line);border-radius:8px;padding:7px 12px;background:transparent;cursor:pointer}
.car-soc-history button[aria-pressed=true]{background:var(--accent-e);color:#0a0a0a}
.car-soc-history button[aria-pressed=true]{background:var(--accent-e);color:var(--on-accent)}
.car-soc-history button:focus-visible{outline:2px solid var(--accent-e);outline-offset:3px}
.car-soc-history .soc-body{padding:18px}.car-soc-history .soc-ranges{display:flex;gap:8px;margin-bottom:14px}
.car-soc-history .soc-note{font-size:.82rem;color:var(--fg-muted);line-height:1.5;margin:10px 0}
.car-soc-history .soc-source{border-top:1px solid var(--line);padding-top:14px;margin-top:14px}
.car-soc-history .soc-last{font:1.3rem var(--mono);margin:8px 0}
.car-soc-history svg{display:block;width:100%;height:auto;min-height:130px;overflow:visible}
.car-soc-history .soc-grid{stroke:var(--line)}.car-soc-history .soc-axis{font:11px var(--mono);fill:var(--fg-muted)}
.car-soc-history .soc-dot{fill:var(--cyan)}.car-soc-history .soc-dot:focus{stroke:var(--fg);stroke-width:2}
.car-soc-history .soc-envelope{stroke:var(--cyan);stroke-width:2}
.car-soc-history .soc-dot{fill:var(--violet)}.car-soc-history .soc-dot:focus{stroke:var(--fg);stroke-width:2}
.car-soc-history .soc-envelope{stroke:var(--violet);stroke-width:2}
@media(max-width:480px){.car-soc-history .soc-axis{font-size:24px}}
`;
}
Expand Down
8 changes: 4 additions & 4 deletions web/components/energy-flow-readings.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ function planetColor(role, watts, thresholdW) {
}
if (role === "pv") return isIdle(watts, thresholdW) ? "var(--fg-muted)" : "var(--amber)";
if (role === "battery") {
return isIdle(watts, thresholdW) ? "var(--cyan)" : watts >= 0 ? "var(--green-e)" : "var(--red-e)";
return !isIdle(watts, thresholdW) && watts < 0 ? "var(--energy-gives)" : "var(--cyan)";
}
if (role === "ev") return isIdle(watts, thresholdW) ? "var(--white-s)" : "var(--green-e)";
if (role === "ev") return isIdle(watts, thresholdW) ? "var(--white-s)" : "var(--violet)";
return "var(--fg)";
}

Expand Down Expand Up @@ -88,8 +88,8 @@ export function flowReadingsFromStatus(status, opts) {
{ text: `↑ ${formatEnergyToday(today, "export_wh", false)}`, color: "var(--green-e)", bold: true },
];
const batDailyParts = [
{ text: `↑ ${formatEnergyToday(today, "bat_charged_wh", false)}`, color: "var(--green-e)", bold: true },
{ text: `↓ ${formatEnergyToday(today, "bat_discharged_wh", false)}`, color: "var(--red-e)", bold: true },
{ text: `↑ ${formatEnergyToday(today, "bat_charged_wh", false)}`, color: "var(--cyan)", bold: true },
{ text: `↓ ${formatEnergyToday(today, "bat_discharged_wh", false)}`, color: "var(--energy-gives)", bold: true },
];

const gridW = num(status && status.grid_w);
Expand Down
Loading
Loading