Give Puerto Rico a warmer island theme and clearer resource icons

This commit is contained in:
coyotte508 2026-10-01 14:01:36 +02:00
commit 4abda4e327
5 changed files with 144 additions and 40 deletions

View file

@ -123,7 +123,7 @@ export function buildingSymbols(id, t) {
break;
case "publishingHouse":
visual =
row(`<b>${t("privilege")} ×2</b>`) +
row(icon("retrigger", 27), `<b>${t("privilege")}</b>`) +
row(icon("planter"), quantity("estate", "+1"));
break;
case "assemblyHall":

View file

@ -1,5 +1,5 @@
const paths = {
corn: '<path fill="#e9b74b" d="M12 5c-4 0-5 4-5 8s2 6 5 6 5-2 5-6-1-8-5-8Z"/><path d="m6 12 6 9 6-9M10 8h4m-4 4h4m-4 4h4"/>',
corn: '<path fill="#f5ca4f" stroke="#95661d" stroke-width="1" d="M12 1C7 1 6 6 6 12c0 5 2 8 6 9 4-1 6-4 6-9 0-6-1-11-6-11Z"/><path stroke="#b88726" stroke-width="1" d="M10 3v13m4-13v13M7 6h10M6 10h12M7 14h10"/><path fill="#6d9954" stroke="#395d38" stroke-width="1" d="M12 22C5 21 2 16 2 10c5 2 9 6 10 12ZM12 22c7-1 10-6 10-12-5 2-9 6-10 12Z"/><path stroke="#bad28a" stroke-width="1" d="m5 14 7 8 7-8"/>',
fruit:
'<path fill="#79a965" d="M12 7C3 2 1 18 10 21c2 1 2-1 4 0 9-3 7-19-2-14Z"/><path d="M12 7V3m0 2c4 0 5-2 5-3"/>',
sugar:
@ -69,6 +69,8 @@ const paths = {
festival:
'<path fill="#d8ba65" d="m12 2 3 6 7 1-5 5 1 8-6-4-6 4 1-8-5-5 7-1Z"/>',
reset: '<path d="M3 10a9 9 0 1 1 2 9M3 3v7h7"/>',
retrigger:
'<path d="M4 8h11a6 6 0 0 1 0 12h-3M4 8l5-5M4 8l5 5"/><path d="M5 16v6m-3-3h6"/>',
arrow: '<path d="M2 12h19m-7-7 7 7-7 7"/>',
erase: '<path d="m4 14 11-11 7 7-11 11H8Zm3-3 7 7m-3 3h12"/>',
dark: '<path fill="#d8ba65" d="M18 2C6-1-1 14 8 21c5 4 13 1 15-5C12 18 7 9 18 2Z"/>',
@ -87,5 +89,5 @@ export function scoreToken(value, size = 26) {
}
export function icon(id, size = 24) {
if (id === "vp") return scoreToken(1, size);
return `<svg class="icon" width="${size}" height="${size}" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${paths[id] ?? paths.building}</svg>`;
return `<svg class="icon icon-${id}" width="${size}" height="${size}" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">${paths[id] ?? paths.building}</svg>`;
}

View file

@ -1,13 +1,18 @@
.pr-game {
--paper: #f4efe2;
--panel: #fffaf0;
--ink: #254c4e;
--muted: #738280;
--line: #d9d9c6;
--sea: #e0eeee;
--gold: #cb9b3d;
--selected: #e1ecd9;
--shadow: #233b3b12;
--paper: #e8dcc1;
--panel: #f7edda;
--ink: #3e392b;
--muted: #716754;
--line: #c6b58e;
--sea: #bfd4c9;
--gold: #c89737;
--selected: #e0e5c4;
--shadow: #49372018;
--terra: #ac6045;
--foliage: #71814c;
--grain: #76522009;
--card: #fbf3e2;
--port-ink: #294d49;
font-family:
system-ui,
-apple-system,
@ -15,7 +20,9 @@
"Segoe UI",
sans-serif;
color: var(--ink);
background: var(--paper);
background-color: var(--paper);
background-image: radial-gradient(var(--grain) 0.7px, transparent 0.7px);
background-size: 5px 5px;
font-size: 14px;
line-height: 1.4;
min-height: 100vh;
@ -24,15 +31,20 @@
color-scheme: light;
}
.pr-game.dark {
--paper: #152c30;
--panel: #1d373b;
--ink: #f1e9d5;
--muted: #acbcb8;
--line: #3b5354;
--sea: #203f45;
--gold: #dbb15d;
--selected: #344e41;
--paper: #242723;
--panel: #34352c;
--ink: #f4e8cc;
--muted: #c0b89f;
--line: #626047;
--sea: #284b48;
--gold: #ddb568;
--selected: #424c33;
--shadow: #0002;
--terra: #c98766;
--foliage: #9eac75;
--grain: #ecd9a708;
--card: #3b382e;
--port-ink: #ebecd8;
color-scheme: dark;
}
.pr-game * {
@ -48,7 +60,7 @@
touch-action: manipulation;
background: var(--panel);
border: 1px solid var(--line);
border-radius: 9px;
border-radius: 3px;
min-height: 42px;
padding: 7px 12px;
display: inline-flex;
@ -122,7 +134,9 @@
margin: 0;
}
.pr-game h2 {
font-size: 17px;
font-family: Georgia, "Times New Roman", serif;
font-size: 20px;
font-weight: normal;
}
.pr-game h3 {
font-size: 12px;
@ -143,11 +157,12 @@
margin: 0 auto;
}
.pr-game .game-header {
position: relative;
height: 78px;
display: flex;
align-items: center;
gap: 25px;
border-bottom: 1px solid var(--line);
border-bottom: 3px double var(--gold);
}
.pr-game .wordmark {
display: flex;
@ -155,6 +170,7 @@
font-family: Georgia, serif;
font-size: 24px;
letter-spacing: 0.12em;
color: var(--ink);
}
.pr-game .wordmark small {
font: 10px system-ui;
@ -175,6 +191,7 @@
white-space: nowrap;
}
.pr-game .round-indicator b {
font-family: Georgia, serif;
font-size: 23px;
margin-left: 5px;
}
@ -192,6 +209,9 @@
justify-content: space-between;
border-bottom-width: 3px;
gap: 4px;
background: transparent;
border-width: 0 0 3px;
border-radius: 0;
}
.pr-game .player-tab.turn {
border-bottom-color: var(--gold);
@ -276,7 +296,7 @@
.pr-game .panel {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 12px;
border-radius: 3px;
padding: 15px;
}
.pr-game .panel > header {
@ -307,6 +327,21 @@
font-size: 11px;
min-width: 0;
min-height: 65px;
border-top: 3px solid var(--role-accent, var(--gold));
background: var(--card);
box-shadow: 0 2px 0 var(--line);
}
.pr-game .role[data-role-id="planter"] {
--role-accent: var(--foliage);
}
.pr-game .role[data-role-id="builder"] {
--role-accent: var(--terra);
}
.pr-game .role[data-role-id="captain"] {
--role-accent: #78a8ae;
}
.pr-game .role[data-role-id="smuggler"] {
--role-accent: #a594af;
}
.pr-game .role-help {
justify-content: center;
@ -327,7 +362,7 @@
flex-direction: column;
gap: 10px;
border: 1px solid var(--line);
border-radius: 8px;
border-radius: 2px;
padding: 12px;
}
.pr-game .role-reference h3 {
@ -362,8 +397,8 @@
font-weight: 600;
}
.pr-game .role.available {
border-color: #8fab99;
background: var(--selected);
border-top-color: var(--role-accent, var(--gold));
background: var(--card);
}
.pr-game .role.taken {
background: transparent;
@ -402,7 +437,18 @@
white-space: nowrap;
}
.pr-game .port {
background: var(--sea);
color: var(--port-ink);
--ink: var(--port-ink);
--muted: var(--port-ink);
background-color: var(--sea);
background-image: repeating-linear-gradient(
174deg,
transparent 0 29px,
#92bfb819 30px 31px,
transparent 32px 60px
);
border-top: 3px solid #71958b;
border-bottom: 3px double #71958b;
}
.pr-game .ships {
display: grid;
@ -445,7 +491,7 @@
}
.pr-game .trade-slot {
border: 1px solid #8aa9a5;
border-radius: 6px;
border-radius: 2px;
width: 38px;
height: 34px;
display: grid;
@ -486,6 +532,8 @@
min-width: 0;
background: transparent;
border-style: dashed;
border-width: 0 0 1px;
border-radius: 0;
}
.pr-game .festival > span:first-of-type {
flex-basis: calc(100% - 26px);
@ -512,6 +560,20 @@
.pr-game .inventory .metric {
margin: 0;
}
.pr-game .inventory .icon-corn {
width: 24px;
height: 24px;
}
.pr-game .player-board {
border-top: 3px solid var(--foliage);
background-image: linear-gradient(110deg, #c6b3760d, transparent 60%);
}
.pr-game .player-board h3 {
color: var(--foliage);
}
.pr-game .player-board h3:last-of-type {
color: var(--terra);
}
.pr-game .estates {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
@ -520,7 +582,7 @@
}
.pr-game .estate {
min-height: 66px;
border-radius: 7px;
border-radius: 2px;
background: var(--selected);
border: 1px solid var(--line);
display: flex;
@ -567,7 +629,8 @@
}
.pr-game .owned-building {
border: 1px solid var(--line);
border-radius: 7px;
border-radius: 2px;
border-top: 3px solid var(--terra);
padding: 5px 4px;
min-height: 98px;
background: var(--paper);
@ -603,6 +666,12 @@
color: var(--muted);
gap: 8px;
}
.pr-game .town-vignette {
display: block;
width: 220px;
max-width: 100%;
height: 62px;
}
.pr-game .action-panel:empty {
display: none;
}
@ -640,6 +709,13 @@
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 7px;
}
.pr-game .building-market {
background: transparent;
border-width: 3px 0 0;
border-style: double;
border-radius: 0;
padding-inline: 0;
}
.pr-game .bcard {
position: relative;
width: 100%;
@ -652,11 +728,16 @@
text-align: left;
padding: 12px;
font-size: 13px;
background: var(--paper);
background: var(--card);
border-top: 3px solid var(--terra);
box-shadow: 0 2px 0 var(--shadow);
align-items: start;
}
.pr-game .bcard.production {
border-top-color: var(--foliage);
}
.pr-game .bcard.affordable {
border-color: #839c75;
border-color: var(--foliage);
background: var(--selected);
}
.pr-game .bcard-title {
@ -668,6 +749,9 @@
padding-right: 46px;
}
.pr-game .bcard-title strong {
font-family: Georgia, "Times New Roman", serif;
font-size: 15px;
font-weight: 600;
line-height: 1.3;
overflow-wrap: anywhere;
}
@ -749,7 +833,7 @@
width: 23px;
height: 24px;
border: 1px dashed var(--muted);
border-radius: 5px;
border-radius: 2px;
}
.pr-game .capacity-slots .icon {
opacity: 0.65;
@ -789,7 +873,7 @@
right: 0;
z-index: 20;
background: var(--panel);
border-top: 1px solid var(--line);
border-top: 3px double var(--gold);
box-shadow: 0 -4px 16px var(--shadow);
padding: 9px max(16px, calc((100vw - 1368px) / 2))
max(9px, env(safe-area-inset-bottom));
@ -846,7 +930,8 @@
color: var(--ink);
background: var(--panel);
border: 1px solid var(--line);
border-radius: 14px;
border-radius: 3px;
border-top: 3px solid var(--gold);
padding: 0;
width: min(620px, calc(100vw - 24px));
max-height: calc(100dvh - 32px);
@ -921,7 +1006,7 @@
padding: 12px;
margin: 12px 0;
background: var(--selected);
border-radius: 8px;
border-radius: 2px;
}
.pr-game .rules-chain li {
display: flex;

16
viewer/town.js Normal file
View file

@ -0,0 +1,16 @@
// Original flat illustration, decorative only: the empty city is not a board piece.
export const town = `<svg class="town-vignette" viewBox="0 0 240 68" aria-hidden="true" fill="none" stroke-linejoin="round">
<path fill="#819a7140" d="M10 60Q35 24 70 47q30-32 65 0 30-25 80 13Z"/>
<path fill="#d9b96f" stroke="#876846" d="M38 29h34v32H38Z"/>
<path fill="#ca8163" stroke="#876846" d="M76 17h37v44H76Z"/>
<path fill="#84a79c" stroke="#536e65" d="M119 35h41v26h-41Z"/>
<path fill="#e1cf9e" stroke="#876846" d="M163 27h30v34h-30Z"/>
<path fill="#b56b4d" d="m34 29 21-12 21 12Zm38-12 22-9 23 9Zm43 18 25-12 24 12Z"/>
<path fill="#bf9e68" d="M161 23h34v5h-34Z"/>
<path stroke="#eee0b7" stroke-width="2" d="M39 46h32m6-7h35m8 10h40m5-7h26"/>
<g fill="#41685b"><path d="M44 35h7v9h-7Zm14 0h7v9h-7ZM82 24h7v10h-7Zm17 0h7v10h-7ZM126 39h7v8h-7Zm20 0h7v8h-7ZM168 32h7v8h-7Zm13 0h7v8h-7Z"/></g>
<path fill="#675442" d="M49 61V49h12v12Zm39 0V45a6 6 0 0 1 12 0v16Zm46 0V51h11v10Zm38 0V49a6 6 0 0 1 12 0v12Z"/>
<path stroke="#a68753" stroke-width="3" d="M210 61q-9-20-3-37"/>
<path fill="#68895a" d="M207 25q-13-15-27-2 13-3 27 2Zm0 0q-2-22 14-22-8 8-14 22Zm0 0q15-16 26-1-14-4-26 1Zm0 0q-12-6-16 11 9-8 16-11Zm0 0q10-4 14 12-9-8-14-12Z"/>
<path stroke="#b09b73" d="M24 62h205"/>
</svg>`;

View file

@ -13,6 +13,7 @@ import { icon, scoreToken } from "./icons.js";
import { journalContent } from "./journal.js";
import { buildingSymbols } from "./building-symbols.js";
import { richText } from "./rich-text.js";
import { town } from "./town.js";
import css from "./style.css";
const esc = (x) =>
@ -354,7 +355,7 @@ export function mountGame(
}
function playerBoard() {
const a = state.players[view];
return `<section class="player-board panel" id="own-board"><header><h2>${playerMarker(view, true)}${esc(a.name)}</h2><div>${metric("coin", a.coins)}${metric("vp", a.vp ?? "?")}${metric("worker", a.reserve.w)}${a.reserve.c ? metric("citizen", a.reserve.c) : ""}</div></header><div class="inventory">${GOODS.map((g) => metric(g, a.goods[g])).join("")}</div><h3>${t("countryside")} <small>${a.estates.length}/12</small></h3><div class="estates">${a.estates.map((x, i) => `<article class="estate ${x.id}" title="${esc(t(x.id))}">${icon(x.id, 31)}${x.id !== "forest" ? peopleSlots(`e${i}`, x) : ""}</article>`).join("")}${Array.from({ length: Math.max(0, 12 - a.estates.length) }, () => '<span class="estate empty-estate"></span>').join("")}</div><h3>${t("city")} <small>${citySize(a)}/12</small></h3><div class="city-grid">${a.buildings.map((x, i) => `<article class="owned-building ${B[x.id].size === 2 ? "expanded" : ""}"><button type="button" data-building="${x.id}" class="building-face" title="${esc(t.effect(x.id))}">${icon(spriteFor(x.id), 28)}<span>${t(x.id)}</span>${pointsBadge(B[x.id].vp)}</button>${peopleSlots(`b${i}`, x, B[x.id].workers)}</article>`).join("")}${a.buildings.length ? "" : `<div class="empty-city">${icon("building", 40)}<span>${t("chooseBuild")}</span></div>`}</div><button class="mobile-market-launch" data-market>${icon("building")} ${t("market")}</button></section>`;
return `<section class="player-board panel" id="own-board"><header><h2>${playerMarker(view, true)}${esc(a.name)}</h2><div>${metric("coin", a.coins)}${metric("vp", a.vp ?? "?")}${metric("worker", a.reserve.w)}${a.reserve.c ? metric("citizen", a.reserve.c) : ""}</div></header><div class="inventory">${GOODS.map((g) => metric(g, a.goods[g])).join("")}</div><h3>${t("countryside")} <small>${a.estates.length}/12</small></h3><div class="estates">${a.estates.map((x, i) => `<article class="estate ${x.id}" title="${esc(t(x.id))}">${icon(x.id, 31)}${x.id !== "forest" ? peopleSlots(`e${i}`, x) : ""}</article>`).join("")}${Array.from({ length: Math.max(0, 12 - a.estates.length) }, () => '<span class="estate empty-estate"></span>').join("")}</div><h3>${t("city")} <small>${citySize(a)}/12</small></h3><div class="city-grid">${a.buildings.map((x, i) => `<article class="owned-building ${B[x.id].size === 2 ? "expanded" : ""}"><button type="button" data-building="${x.id}" class="building-face" title="${esc(t.effect(x.id))}">${icon(spriteFor(x.id), 28)}<span>${t(x.id)}</span>${pointsBadge(B[x.id].vp)}</button>${peopleSlots(`b${i}`, x, B[x.id].workers)}</article>`).join("")}${a.buildings.length ? "" : `<div class="empty-city">${town}<span>${t("chooseBuild")}</span></div>`}</div><button class="mobile-market-launch" data-market>${icon("building")} ${t("market")}</button></section>`;
}
function shipGraphic(sh) {
return `<svg class="ship-art" viewBox="0 0 200 112" aria-hidden="true"><path fill="#edf0d4" stroke="#b6a37b" d="M96 6v58H42Zm10 9v49h43Z"/><path fill="#80614b" d="m12 66 17 31q75 22 143-3l18-28Z"/><path fill="none" stroke="#d7ac75" stroke-width="3" d="m28 77 144 0m-70-74v65"/>${Array.from({ length: sh.capacity }, (_, i) => `<rect x="${22 + i * (155 / sh.capacity)}" y="72" width="${Math.min(18, 140 / sh.capacity)}" height="17" rx="2" fill="${i < sh.amount ? "#e6c06f" : "#483e38"}" stroke="#bfa587"/>`).join("")}<path d="M5 105q20-10 40 0t40 0t40 0t40 0t30 0" fill="none" stroke="#9bbebc" stroke-width="2"/></svg>`;
@ -366,7 +367,7 @@ export function mountGame(
.map((r) => {
const m = state.legal.find((m) => m.type === "role" && m.id === r.id),
selected = r.taken !== null;
return `<button class="role ${selected ? "taken" : ""} ${m ? "available" : ""}" ${selected ? `title="${esc(t(r.id))} · ${esc(state.players[r.taken].name)}"` : ""} ${m && acting ? `data-move="${encode(m)}"` : `data-role="${r.id}"`}><span class="role-icon">${icon(r.id === "adventurer2" ? "adventurer" : r.id, 32)}${r.coins ? `<span class="coin-badge">${r.coins}</span>` : ""}</span><b>${t(r.id)}</b>${selected ? playerMarker(r.taken) : ""}</button>`;
return `<button data-role-id="${r.id}" class="role ${selected ? "taken" : ""} ${m ? "available" : ""}" ${selected ? `title="${esc(t(r.id))} · ${esc(state.players[r.taken].name)}"` : ""} ${m && acting ? `data-move="${encode(m)}"` : `data-role="${r.id}"`}><span class="role-icon">${icon(r.id === "adventurer2" ? "adventurer" : r.id, 32)}${r.coins ? `<span class="coin-badge">${r.coins}</span>` : ""}</span><b>${t(r.id)}</b>${selected ? playerMarker(r.taken) : ""}</button>`;
})
.join(
"",