Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

refactor(theme): migrate tilemap/tileset onto canonical tokens

yhhdccfeade99be
diff --git a/desktop/src/theme/launcher.css b/desktop/src/theme/launcher.css
index 5a7af2459..2270a186c 100644
--- a/desktop/src/theme/launcher.css
+++ b/desktop/src/theme/launcher.css
@@ -353,7 +353,7 @@
}
.proj-card:hover .proj-card__remove,
.proj-card:focus-within .proj-card__remove { opacity: 1; }
-.proj-card__remove:hover { color: var(--danger, #e5484d); border-color: var(--danger, #e5484d); }
+.proj-card__remove:hover { color: var(--error); border-color: var(--error); }
/* ----------------------------------------------------------- list view --- */
.proj-list {
@@ -419,7 +419,7 @@
}
.proj-row:hover .proj-row__remove,
.proj-row:focus-within .proj-row__remove { opacity: 1; }
-.proj-row__remove:hover { color: var(--danger, #e5484d); border-color: var(--danger, #e5484d); }
+.proj-row__remove:hover { color: var(--error); border-color: var(--error); }
/* Name over path, both left-aligned to the column edge — so every row's text
starts at the same x and lines up under the "Project" header. */
.proj-row__main {
diff --git a/desktop/src/theme/tilemap.css b/desktop/src/theme/tilemap.css
index 00199c9eb..874144d37 100644
--- a/desktop/src/theme/tilemap.css
+++ b/desktop/src/theme/tilemap.css
@@ -6,9 +6,9 @@
display: flex;
flex-direction: column;
height: 100%;
- background: var(--srf-1, #16181c);
- color: var(--text, #d6d9de);
- font-size: 12px;
+ background: var(--srf-1);
+ color: var(--text);
+ font-size: var(--fs-sm);
}
.tp-tools {
@@ -16,8 +16,8 @@
align-items: center;
gap: 4px;
padding: 6px 10px;
- border-bottom: 1px solid var(--line, #2a2d33);
- background: var(--srf-2, #1b1e23);
+ border-bottom: 1px solid var(--line);
+ background: var(--srf-2);
flex: 0 0 auto;
}
@@ -29,20 +29,20 @@
gap: 4px;
padding: 5px 8px;
overflow-x: auto;
- background: var(--srf-2, #1b1e23);
- border-bottom: 1px solid var(--line, #2a2d33);
+ background: var(--srf-2);
+ border-bottom: 1px solid var(--line);
flex: 0 0 auto;
}
.tp-layer {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
- background: var(--control, #24272d);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
+ background: var(--srf-3);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
overflow: hidden;
}
-.tp-layer.is-active { border-color: var(--star, #4c8fd6); background: rgba(76, 143, 214, 0.16); }
+.tp-layer.is-active { border-color: var(--star); background: var(--star-dim); }
.tp-layer-vis,
.tp-layer-lock {
display: inline-flex;
@@ -52,15 +52,15 @@
align-self: stretch;
background: none;
border: none;
- color: var(--text-faint, #6b717c);
+ color: var(--text-faint);
cursor: pointer;
}
.tp-layer-vis:hover,
-.tp-layer-lock:hover { color: var(--text, #d6d9de); background: var(--control-hover, #333740); }
+.tp-layer-lock:hover { color: var(--text); background: var(--srf-4); }
.tp-layer-name {
background: none;
border: none;
- color: var(--text-dim, #9aa0aa);
+ color: var(--text-dim);
padding: 4px 7px;
cursor: pointer;
font: inherit;
@@ -69,15 +69,15 @@
overflow: hidden;
text-overflow: ellipsis;
}
-.tp-layer.is-active .tp-layer-name { color: var(--text, #d6d9de); }
-.tp-layer-name:hover { color: var(--text, #d6d9de); }
+.tp-layer.is-active .tp-layer-name { color: var(--text); }
+.tp-layer-name:hover { color: var(--text); }
.tp-grow { flex: 1 1 auto; }
-.tp-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line, #2a2d33); }
+.tp-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--line); }
.tp-brush {
display: inline-flex;
align-items: center;
gap: 6px;
- color: var(--text-faint, #6b717c);
+ color: var(--text-faint);
font-variant-numeric: tabular-nums;
}
/* Live thumbnail of the active brush (real tiles + orientation) — the ghost geometry
@@ -86,9 +86,9 @@
position: relative;
display: inline-block;
overflow: hidden;
- border: 1px solid var(--line, #2a2d33);
- border-radius: 2px;
- background: var(--srf-0, #101216);
+ border: 1px solid var(--line);
+ border-radius: var(--r-xs);
+ background: var(--srf-0);
image-rendering: pixelated;
}
.tp-brushthumb-in { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
@@ -99,17 +99,17 @@
justify-content: center;
width: 28px;
height: 26px;
- background: var(--control, #24272d);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ background: var(--srf-3);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
cursor: pointer;
}
-.tp-tool:hover { color: var(--text, #d6d9de); border-color: var(--control-hover, #333740); }
+.tp-tool:hover { color: var(--text); border-color: var(--srf-4); }
.tp-tool.is-active {
- background: var(--star, #4c8fd6);
- border-color: var(--star, #4c8fd6);
- color: var(--on-accent, #fff);
+ background: var(--star);
+ border-color: var(--star);
+ color: var(--on-accent);
}
/* Palette zoom bar — small tilesets are unclickable at 1:1, so − / + / fit. */
@@ -118,8 +118,8 @@
align-items: center;
gap: 4px;
padding: 4px 8px;
- background: var(--srf-0, #101216);
- border-bottom: 1px solid var(--line, #2a2d33);
+ background: var(--srf-0);
+ border-bottom: 1px solid var(--line);
flex: 0 0 auto;
}
.tp-zbtn {
@@ -128,17 +128,17 @@
justify-content: center;
width: 22px;
height: 20px;
- background: var(--control, #24272d);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ background: var(--srf-3);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
cursor: pointer;
}
-.tp-zbtn:hover { color: var(--text, #d6d9de); border-color: var(--control-hover, #333740); }
+.tp-zbtn:hover { color: var(--text); border-color: var(--srf-4); }
.tp-zpct {
min-width: 42px;
text-align: center;
- color: var(--text-faint, #6b717c);
+ color: var(--text-faint);
font-variant-numeric: tabular-nums;
}
@@ -146,7 +146,7 @@
flex: 1 1 auto;
overflow: auto;
padding: 12px;
- background: var(--srf-0, #101216);
+ background: var(--srf-0);
}
/* Sizer carries the zoomed layout box (natural × zoom) so the palette scrolls; the atlas
inside is drawn at natural size and CSS-scaled to fill it (crisp hit-testing + pixels). */
@@ -161,23 +161,23 @@
display: flex;
flex-direction: column;
gap: 4px;
- background: var(--srf-0, #101216);
+ background: var(--srf-0);
}
.tp-terrain {
display: inline-flex;
align-items: center;
gap: 7px;
- background: var(--control, #24272d);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ background: var(--srf-3);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
padding: 5px 9px;
cursor: pointer;
font: inherit;
text-align: left;
}
-.tp-terrain.is-active { border-color: var(--star, #4c8fd6); color: var(--text, #d6d9de); }
-.tp-tswatch { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
+.tp-terrain.is-active { border-color: var(--star); color: var(--text); }
+.tp-tswatch { width: 12px; height: 12px; border-radius: var(--r-xs); display: inline-block; }
/* Multi-tileset tab bar — switch which of the layer's tilesets the palette paints from. */
.tp-tilesets {
@@ -186,31 +186,31 @@
gap: 4px;
padding: 6px 8px;
overflow-x: auto;
- background: var(--srf-0, #101216);
- border-bottom: 1px solid var(--line, #2a2d33);
+ background: var(--srf-0);
+ border-bottom: 1px solid var(--line);
}
/* A tileset tab = a name button + (when the layer has >1 tileset) a remove ×. */
.tp-tschip {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
- background: var(--control, #24272d);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
+ background: var(--srf-3);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
overflow: hidden;
}
-.tp-tschip.is-active { border-color: var(--star, #4c8fd6); }
+.tp-tschip.is-active { border-color: var(--star); }
.tp-tsbtn {
background: none;
border: none;
- color: var(--text-dim, #9aa0aa);
+ color: var(--text-dim);
padding: 3px 9px;
cursor: pointer;
font: inherit;
white-space: nowrap;
}
-.tp-tsbtn:hover { color: var(--text, #d6d9de); }
-.tp-tschip.is-active .tp-tsbtn { color: var(--text, #d6d9de); }
+.tp-tsbtn:hover { color: var(--text); }
+.tp-tschip.is-active .tp-tsbtn { color: var(--text); }
.tp-tsx {
display: inline-flex;
align-items: center;
@@ -219,11 +219,11 @@
align-self: stretch;
background: none;
border: none;
- border-left: 1px solid var(--line, #2a2d33);
- color: var(--text-faint, #6b717c);
+ border-left: 1px solid var(--line);
+ color: var(--text-faint);
cursor: pointer;
}
-.tp-tsx:hover { color: var(--danger, #e5484d); background: var(--control-hover, #333740); }
+.tp-tsx:hover { color: var(--error); background: var(--srf-4); }
/* Add-tileset opener + dropdown of the project's other .estileset assets. */
.tp-tsadd-wrap { position: relative; flex: 0 0 auto; }
.tp-tsadd {
@@ -232,13 +232,13 @@
justify-content: center;
width: 24px;
height: 24px;
- background: var(--control, #24272d);
- border: 1px dashed var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ background: var(--srf-3);
+ border: 1px dashed var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
cursor: pointer;
}
-.tp-tsadd:hover { color: var(--text, #d6d9de); border-color: var(--star, #4c8fd6); }
+.tp-tsadd:hover { color: var(--text); border-color: var(--star); }
.tp-tsmenu {
position: absolute;
top: calc(100% + 4px);
@@ -248,9 +248,9 @@
max-height: 240px;
overflow-y: auto;
padding: 4px;
- background: var(--srf-2, #1b1e23);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 4px;
+ background: var(--srf-2);
+ border: 1px solid var(--line);
+ border-radius: var(--r-md);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.tp-tsmenu-item {
@@ -259,16 +259,16 @@
text-align: left;
background: none;
border: none;
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
padding: 5px 8px;
cursor: pointer;
font: inherit;
white-space: nowrap;
}
-.tp-tsmenu-item:hover { background: var(--control-hover, #333740); color: var(--text, #d6d9de); }
-.tp-tsmenu-empty { color: var(--text-faint, #6b717c); padding: 6px 8px; font-size: 11px; }
-.tp-warn { color: var(--text-faint, #6b717c); padding: 12px; font-size: 11px; }
+.tp-tsmenu-item:hover { background: var(--srf-4); color: var(--text); }
+.tp-tsmenu-empty { color: var(--text-faint); padding: 6px 8px; font-size: var(--fs-xs); }
+.tp-warn { color: var(--text-faint); padding: 12px; font-size: var(--fs-xs); }
.tp-cell {
position: absolute;
@@ -276,11 +276,11 @@
border: 1px solid transparent;
cursor: pointer;
}
-.tp-cell:hover { border-color: rgba(76, 143, 214, 0.6); background: rgba(76, 143, 214, 0.14); }
+.tp-cell:hover { border-color: var(--star-line); background: var(--star-dim); }
.tp-cell.is-sel {
- border-color: var(--star, #4c8fd6);
- box-shadow: inset 0 0 0 1px var(--star, #4c8fd6);
- background: rgba(76, 143, 214, 0.18);
+ border-color: var(--star);
+ box-shadow: inset 0 0 0 1px var(--star);
+ background: var(--star-dim);
}
.tp-empty,
@@ -293,6 +293,6 @@
gap: 6px;
padding: 16px;
text-align: center;
- color: var(--text-faint, #6b717c);
+ color: var(--text-faint);
}
-.tp-hint { font-size: 11px; max-width: 280px; }
+.tp-hint { font-size: var(--fs-xs); max-width: 280px; }
diff --git a/desktop/src/theme/tileset.css b/desktop/src/theme/tileset.css
index fb7560eac..29c245539 100644
--- a/desktop/src/theme/tileset.css
+++ b/desktop/src/theme/tileset.css
@@ -7,9 +7,9 @@
flex-direction: column;
height: 100%;
position: relative;
- background: var(--srf-1, #16181c);
- color: var(--text, #d6d9de);
- font-size: 12px;
+ background: var(--srf-1);
+ color: var(--text);
+ font-size: var(--fs-sm);
}
.ts-toolbar {
@@ -17,8 +17,8 @@
align-items: center;
gap: 10px;
padding: 6px 10px;
- border-bottom: 1px solid var(--line, #2a2d33);
- background: var(--srf-2, #1b1e23);
+ border-bottom: 1px solid var(--line);
+ background: var(--srf-2);
flex: 0 0 auto;
}
@@ -26,37 +26,37 @@
display: inline-flex;
align-items: center;
gap: 5px;
- color: var(--text-dim, #9aa0aa);
+ color: var(--text-dim);
}
.ts-field span { user-select: none; }
.ts-field input[type='number'] {
width: 46px;
- background: var(--inset, #0f1115);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text, #d6d9de);
+ background: var(--inset);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text);
padding: 2px 4px;
font: inherit;
}
.ts-field input[type='range'] { width: 90px; }
-.ts-sep { width: 1px; align-self: stretch; background: var(--line, #2a2d33); margin: 0 2px; }
+.ts-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
.ts-grow { flex: 1 1 auto; }
-.ts-stat { color: var(--text-faint, #6b717c); font-variant-numeric: tabular-nums; }
+.ts-stat { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ts-save {
display: inline-flex;
align-items: center;
gap: 5px;
- background: var(--star, #4c8fd6);
- color: var(--on-accent, #fff);
+ background: var(--star);
+ color: var(--on-accent);
border: none;
- border-radius: 3px;
+ border-radius: var(--r-sm);
padding: 4px 9px;
cursor: pointer;
font: inherit;
}
-.ts-save:disabled { background: var(--control, #2a2d33); color: var(--text-faint, #6b717c); cursor: default; }
+.ts-save:disabled { background: var(--srf-3); color: var(--text-faint); cursor: default; }
.ts-canvas {
flex: 1 1 auto;
@@ -64,11 +64,11 @@
padding: 16px;
/* A checkerboard so transparent atlas regions read clearly. */
background:
- linear-gradient(45deg, var(--srf-0, #101216) 25%, transparent 25%) 0 0 / 16px 16px,
- linear-gradient(-45deg, var(--srf-0, #101216) 25%, transparent 25%) 0 8px / 16px 16px,
- linear-gradient(45deg, transparent 75%, var(--srf-0, #101216) 75%) 8px -8px / 16px 16px,
- linear-gradient(-45deg, transparent 75%, var(--srf-0, #101216) 75%) -8px 0 / 16px 16px,
- var(--srf-1, #16181c);
+ linear-gradient(45deg, var(--srf-0) 25%, transparent 25%) 0 0 / 16px 16px,
+ linear-gradient(-45deg, var(--srf-0) 25%, transparent 25%) 0 8px / 16px 16px,
+ linear-gradient(45deg, transparent 75%, var(--srf-0) 75%) 8px -8px / 16px 16px,
+ linear-gradient(-45deg, transparent 75%, var(--srf-0) 75%) -8px 0 / 16px 16px,
+ var(--srf-1);
}
.ts-stage { position: relative; }
@@ -83,10 +83,10 @@
.ts-cell {
position: absolute;
box-sizing: border-box;
- border: 1px solid rgba(255, 255, 255, 0.08);
+ border: 1px solid var(--line);
cursor: pointer;
}
-.ts-cell:hover { border-color: var(--star, #4c8fd6); background: rgba(76, 143, 214, 0.12); }
+.ts-cell:hover { border-color: var(--star); background: var(--star-dim); }
.ts-cell.is-solid {
background: rgba(240, 100, 90, 0.34);
border-color: rgba(240, 100, 90, 0.85);
@@ -100,49 +100,49 @@
gap: 6px;
flex-wrap: wrap;
padding: 6px 10px;
- border-bottom: 1px solid var(--line, #2a2d33);
- background: var(--srf-2, #1b1e23);
+ border-bottom: 1px solid var(--line);
+ background: var(--srf-2);
flex: 0 0 auto;
}
.ts-terrain {
display: inline-flex;
align-items: center;
gap: 5px;
- background: var(--control, #24272d);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ background: var(--srf-3);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
padding: 3px 8px;
cursor: pointer;
font: inherit;
}
-.ts-terrain.is-active { border-color: var(--star, #4c8fd6); color: var(--text, #d6d9de); }
-.ts-tswatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
-.ts-tmode { color: var(--text-faint, #6b717c); font-size: 10px; }
+.ts-terrain.is-active { border-color: var(--star); color: var(--text); }
+.ts-tswatch { width: 11px; height: 11px; border-radius: var(--r-xs); display: inline-block; }
+.ts-tmode { color: var(--text-faint); font-size: var(--fs-2xs); }
.ts-add { padding: 3px 6px; }
.ts-tedit { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.ts-tname {
width: 110px;
- background: var(--inset, #0f1115);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text, #d6d9de);
+ background: var(--inset);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text);
padding: 2px 6px;
font: inherit;
}
.ts-tedit select {
- background: var(--inset, #0f1115);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text, #d6d9de);
+ background: var(--inset);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text);
padding: 2px 4px;
font: inherit;
}
.ts-trm {
background: none;
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
padding: 3px 5px;
cursor: pointer;
}
@@ -161,14 +161,14 @@
cursor: pointer;
}
.ts-zone:hover { background: rgba(255, 255, 255, 0.18); }
-.ts-zone.is-on { background: rgba(76, 143, 214, 0.55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
+.ts-zone.is-on { background: var(--star-line); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.ts-zone.is-corner.is-on { background: rgba(214, 196, 76, 0.6); }
.ts-zone-c { left: 33.34%; top: 33.34%; }
.ts-zone-c:hover { background: rgba(255, 255, 255, 0.1); }
/* Polygon-collision cell marker + the focused polygon editor overlay */
.ts-pcell.is-poly { background: rgba(90, 200, 250, 0.22); border-color: rgba(90, 200, 250, 0.85); }
-.ts-pcell:hover { border-color: var(--star, #4c8fd6); background: rgba(76, 143, 214, 0.12); }
+.ts-pcell:hover { border-color: var(--star); background: var(--star-dim); }
.ts-pe-backdrop {
position: absolute;
@@ -176,40 +176,40 @@
display: flex;
align-items: center;
justify-content: center;
- background: rgba(0, 0, 0, 0.55);
+ background: var(--overlay);
z-index: 20;
}
.ts-pe {
- background: var(--srf-2, #1b1e23);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 6px;
+ background: var(--srf-2);
+ border: 1px solid var(--line);
+ border-radius: var(--r-lg);
padding: 10px;
display: flex;
flex-direction: column;
gap: 8px;
}
-.ts-pe-head { display: flex; align-items: center; gap: 8px; color: var(--text, #d6d9de); }
+.ts-pe-head { display: flex; align-items: center; gap: 8px; color: var(--text); }
.ts-pe-head button {
- background: var(--control, #24272d);
- border: 1px solid var(--line, #2a2d33);
- border-radius: 3px;
- color: var(--text-dim, #9aa0aa);
+ background: var(--srf-3);
+ border: 1px solid var(--line);
+ border-radius: var(--r-sm);
+ color: var(--text-dim);
padding: 3px 9px;
cursor: pointer;
font: inherit;
}
-.ts-pe-head button:hover { color: var(--text, #d6d9de); }
+.ts-pe-head button:hover { color: var(--text); }
.ts-pe-stage {
position: relative;
image-rendering: pixelated;
- border: 1px solid var(--line, #2a2d33);
+ border: 1px solid var(--line);
cursor: crosshair;
}
.ts-pe-svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.ts-pe-poly { fill: rgba(90, 200, 250, 0.3); stroke: #5ac8fa; stroke-width: 0.5; }
.ts-pe-pt { fill: #fff; stroke: #5ac8fa; stroke-width: 0.5; pointer-events: auto; cursor: pointer; }
.ts-pe-pt:hover { fill: #f0645a; }
-.ts-pe-hint { color: var(--text-faint, #6b717c); font-size: 11px; text-align: center; }
+.ts-pe-hint { color: var(--text-faint); font-size: var(--fs-xs); text-align: center; }
.ts-empty,
.ts-warn {
@@ -219,6 +219,6 @@
justify-content: center;
height: 100%;
gap: 6px;
- color: var(--text-faint, #6b717c);
+ color: var(--text-faint);
}
-.ts-hint { font-size: 11px; }
+.ts-hint { font-size: var(--fs-xs); }