From 08095ae1e66c65a4e8b8e7b880b27036c01e0950 Mon Sep 17 00:00:00 2001 From: coyotte508 Date: Fri, 2 Oct 2026 01:38:51 +0200 Subject: [PATCH] Apply platform colours to crew markers --- preview/app.js | 13 +++++++++++-- preview/style.css | 10 +++++++--- preview/tactical.js | 10 ++++++++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/preview/app.js b/preview/app.js index 0e4afce..759ed47 100644 --- a/preview/app.js +++ b/preview/app.js @@ -51,9 +51,17 @@ export function mountConsole(root, host = null) { hosted: !!host, }); let appearance = {}; + const playerColor = (i) => { + const color = appearance.playerColors?.[i]; + return typeof color === "string" && /^#[a-f0-9]{6}$/i.test(color) + ? color + : ""; + }; const playerBadge = (i) => { const badge = appearance.players?.[i]?.pro && appearance.supporterBadge; - return badge ? `${esc(badge.label)}` : ""; + return badge + ? `${esc(badge.label)}` + : ""; }; const playerName = (i) => esc(view?.players[i]?.name ?? `${t("Joueur", "Player")} ${i + 1}`); @@ -119,6 +127,7 @@ export function mountConsole(root, host = null) { esc, symbol, zoneName, + playerColor, }); function updateSound() { const button = $("#sound"); @@ -303,7 +312,7 @@ export function mountConsole(root, host = null) { $("#crew").innerHTML = view.players .map( (p) => - `${playerName(p.seat)}${playerBadge(p.seat)} 路 ${p.planningPhase ? `${p.finishedPlanning ? "馃敀" : t("Phase", "Phase")} ${p.planningPhase}` : p.ready ? t("pr茅sent", "ready") : t("attente", "waiting")}`, + `${playerName(p.seat)}${playerBadge(p.seat)} 路 ${p.planningPhase ? `${p.finishedPlanning ? "馃敀" : t("Phase", "Phase")} ${p.planningPhase}` : p.ready ? t("pr茅sent", "ready") : t("attente", "waiting")}`, ) .join(""); $("#ship-title").textContent = t("Le vaisseau", "The ship"); diff --git a/preview/style.css b/preview/style.css index fff4da2..9fc0852 100644 --- a/preview/style.css +++ b/preview/style.css @@ -168,6 +168,7 @@ h1 { margin: 8px 0 16px; } .crew-member { + box-shadow: inset 3px 0 var(--player-color, transparent); font-size: 12px; border: 1px solid var(--line); padding: 5px 9px; @@ -1360,19 +1361,22 @@ input:not([type="checkbox"]):not([type="range"]) { display: inline-flex; width: 23px; height: 29px; - color: #bfd0db; + color: var(--player-color, #bfd0db); } .crew-pawn > svg { width: 100%; height: 100%; fill: currentColor; - stroke: #0a2231; + stroke: var(--player-stroke, #0a2231); stroke-width: 1.5; } .crew-pawn .visor { fill: #2a5969; } .crew-pawn b { + text-shadow: + 0 0 2px #fff, + 0 0 2px #fff; position: absolute; bottom: 3px; width: 100%; @@ -1381,7 +1385,7 @@ input:not([type="checkbox"]):not([type="range"]) { font-size: 11px; } .crew-pawn.selected { - color: #ffe0a0; + color: var(--player-color, #ffe0a0); filter: drop-shadow(0 0 2px #e8c98460); } .crew-pawn.out { diff --git a/preview/tactical.js b/preview/tactical.js index 91ab0d9..89122c8 100644 --- a/preview/tactical.js +++ b/preview/tactical.js @@ -1,7 +1,13 @@ import { illustration, threatIllustration } from "./art.js"; import { pictogram, shipLocator } from "./icons.js"; -export function createTacticalView({ t, esc, symbol, zoneName }) { +export function createTacticalView({ + t, + esc, + symbol, + zoneName, + playerColor = () => "", +}) { const meter = (value, capacity) => ``; @@ -141,7 +147,7 @@ export function createTacticalView({ t, esc, symbol, zoneName }) { level === "upper" ? t("Pont sup茅rieur", "Upper deck") : t("Pont inf茅rieur", "Lower deck"); - return `
${esc(zoneName(zone))}${symbol(level === "upper" ? "up" : "down", deckName)}${level === "upper" && s.damage.length ? `${symbol("warning", `${t("D茅g芒ts de la zone", "Zone damage")} : ${s.damage.length}/6`, `${s.damage.length}/6`)}` : ""}
${stationControls({ station, zone, deck: level, ship, power, capacity, system, cIcon, c, canPlan })}
${occupants.map((p) => `${p.id + 1}${p.bots !== null ? `${pictogram("bots")}` : ""}`).join("")}
`; + return `
${esc(zoneName(zone))}${symbol(level === "upper" ? "up" : "down", deckName)}${level === "upper" && s.damage.length ? `${symbol("warning", `${t("D茅g芒ts de la zone", "Zone damage")} : ${s.damage.length}/6`, `${s.damage.length}/6`)}` : ""}
${stationControls({ station, zone, deck: level, ship, power, capacity, system, cIcon, c, canPlan })}
${occupants.map((p) => `${p.id + 1}${p.bots !== null ? `${pictogram("bots")}` : ""}`).join("")}
`; }) .join( "",