Add theme settings, and remove the old theme system
This commit is contained in:
parent
567ac1a26d
commit
9f4a3197de
22 changed files with 2301 additions and 463 deletions
3
How/Plan7.md
Normal file
3
How/Plan7.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
1. Figure out how to properly implement co-op
|
||||
2. Proceed with the implementation of co-op but using the already existing parts.
|
||||
3. Fix the stylings and stuff so that small screens don't cause overlapping DOM elements.
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
/* Chamfers, chamfers, and yes. More chamfers. */
|
||||
.panel {
|
||||
background: var(--bg-panel);
|
||||
background-color: var(--bg-panel);
|
||||
background-image: var(--panel-gradient);
|
||||
backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-panel);
|
||||
clip-path: var(--chamfer);
|
||||
position: relative;
|
||||
transition: border-color 0.35s ease;
|
||||
|
|
@ -18,8 +20,10 @@
|
|||
.card {
|
||||
padding: 14px 16px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
background: var(--bg-panel);
|
||||
background-color: var(--bg-panel);
|
||||
background-image: var(--panel-gradient);
|
||||
cursor: pointer;
|
||||
transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.12s ease;
|
||||
position: relative;
|
||||
|
|
@ -43,6 +47,7 @@
|
|||
padding: 10px 20px;
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border-bright);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
color: var(--text);
|
||||
font-family: var(--mono);
|
||||
|
|
@ -61,27 +66,27 @@
|
|||
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
|
||||
|
||||
.btn.primary {
|
||||
background: rgba(52, 152, 219, 0.18);
|
||||
background: var(--btn-primary-bg);
|
||||
border-color: var(--brand-strong);
|
||||
color: #dbeafe;
|
||||
color: var(--btn-primary-text);
|
||||
}
|
||||
.btn.primary:hover:not(:disabled) {
|
||||
background: rgba(52, 152, 219, 0.34);
|
||||
background: var(--btn-primary-hover);
|
||||
border-color: var(--brand-blue);
|
||||
color: #ffffff;
|
||||
color: var(--btn-primary-text);
|
||||
}
|
||||
.btn.warn {
|
||||
background: rgba(245, 158, 11, 0.15);
|
||||
background: var(--btn-warn-bg);
|
||||
border-color: var(--amber);
|
||||
color: #fde68a;
|
||||
color: var(--btn-warn-text);
|
||||
}
|
||||
.btn.danger {
|
||||
background: rgba(248, 113, 113, 0.12);
|
||||
border-color: rgba(248, 113, 113, 0.5);
|
||||
color: #fecaca;
|
||||
background: var(--btn-danger-bg);
|
||||
border-color: var(--red);
|
||||
color: var(--btn-danger-text);
|
||||
}
|
||||
.btn.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); background: rgba(248, 113, 113, 0.22); }
|
||||
.btn.ghost { background: rgba(18, 22, 31, 0.65); border-color: var(--border); color: var(--text-dim); }
|
||||
.btn.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); background: var(--btn-danger-bg); }
|
||||
.btn.ghost { background: var(--btn-ghost-bg); border-color: var(--border); color: var(--text-dim); }
|
||||
.btn.ghost:hover:not(:disabled) { border-color: var(--border-bright); color: var(--text); }
|
||||
.btn.sm { padding: 6px 12px; font-size: 10px; }
|
||||
.btn.xs { padding: 4px 8px; font-size: 9px; letter-spacing: 0.08em; }
|
||||
|
|
@ -96,6 +101,7 @@
|
|||
padding: 9px 12px;
|
||||
background: var(--bg-deep);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
color: var(--text);
|
||||
font-family: var(--mono);
|
||||
|
|
@ -124,7 +130,8 @@ input[type="range"].slider {
|
|||
font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
border: 1px solid var(--border-bright); color: var(--text-dim);
|
||||
background: rgba(11, 14, 20, 0.7);
|
||||
background: var(--badge-bg);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
}
|
||||
.badge.ok { color: var(--green); border-color: rgba(52, 211, 153, 0.5); }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* Modals, toasts, notification window, co-op toggle vicodins, value chart, grid (forgot which one), and toggles. */
|
||||
.modal-overlay {
|
||||
position: fixed; inset: 0; background: rgba(7, 10, 15, 0.84); backdrop-filter: blur(4px);
|
||||
position: fixed; inset: 0; background: var(--overlay-scrim); backdrop-filter: blur(4px);
|
||||
display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
|
||||
}
|
||||
.modal { width: min(500px, 100%); max-height: 85vh; overflow-y: auto; padding: 24px; }
|
||||
|
|
@ -11,10 +11,10 @@
|
|||
display: flex; flex-direction: column; gap: 8px; pointer-events: none;
|
||||
}
|
||||
.toast {
|
||||
padding: 11px 16px; clip-path: var(--chamfer-sm);
|
||||
padding: 11px 16px; border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; max-width: 380px;
|
||||
background: var(--bg-elevated); border: 1px solid var(--border-bright);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
|
||||
box-shadow: var(--shadow-elevated);
|
||||
animation: slideIn 0.2s ease;
|
||||
}
|
||||
.toast.ok { border-color: var(--green); }
|
||||
|
|
@ -33,9 +33,9 @@
|
|||
|
||||
.notif-toggle-bar {
|
||||
display: flex; align-items: center;
|
||||
background: rgba(18, 22, 31, 0.94); backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border-bright); clip-path: var(--chamfer-sm);
|
||||
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
|
||||
background: var(--bg-glass); backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border-bright); border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
box-shadow: var(--shadow-elevated);
|
||||
max-width: 360px; overflow: hidden;
|
||||
}
|
||||
.notif-toggle-main {
|
||||
|
|
@ -49,22 +49,22 @@
|
|||
text-overflow: ellipsis; white-space: nowrap;
|
||||
}
|
||||
.notif-hide-btn {
|
||||
padding: 7px 9px; background: rgba(11, 14, 20, 0.5); border: none;
|
||||
padding: 7px 9px; background: var(--bg-inset); border: none;
|
||||
border-left: 1px solid var(--border); color: var(--text-dim); cursor: pointer;
|
||||
font-family: var(--mono); font-size: 12px; line-height: 1;
|
||||
}
|
||||
.notif-hide-btn:hover { color: var(--text); background: var(--bg-hover); }
|
||||
.notif-mini-pill {
|
||||
padding: 6px 10px; background: rgba(18, 22, 31, 0.9);
|
||||
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
|
||||
padding: 6px 10px; background: var(--bg-glass);
|
||||
box-shadow: var(--shadow-elevated);
|
||||
}
|
||||
|
||||
.notif-drawer {
|
||||
width: min(370px, calc(100vw - var(--right-sidebar-offset, 0px) - 32px)); max-height: 340px;
|
||||
display: flex; flex-direction: column; padding: 10px 12px; gap: 8px;
|
||||
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
|
||||
box-shadow: var(--shadow-modal);
|
||||
}
|
||||
.notif-header { padding-bottom: 4px; border-bottom: 1px solid rgba(42, 52, 73, 0.6); }
|
||||
.notif-header { padding-bottom: 4px; border-bottom: 1px solid var(--border-subtle); }
|
||||
.notif-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
|
||||
.notif-list {
|
||||
flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
}
|
||||
.notif-item {
|
||||
padding: 7px 9px; background: var(--bg-deep); border: 1px solid var(--border);
|
||||
border-left-width: 3px; clip-path: var(--chamfer-sm);
|
||||
border-left-width: 3px; border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
font-family: var(--mono); font-size: 11px; line-height: 1.35;
|
||||
}
|
||||
.notif-item.ok { border-left-color: var(--green); }
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
.builder-summary-bar {
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: rgba(11, 14, 20, 0.72);
|
||||
background: var(--bg-inset);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
.builder-coop-bar {
|
||||
padding: 6px 12px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: rgba(18, 22, 31, 0.85);
|
||||
background: var(--bg-glass);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 5px;
|
||||
|
|
@ -159,6 +159,7 @@
|
|||
border: 1px solid var(--border);
|
||||
background: var(--bg-deep);
|
||||
color: var(--text-dim);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s, color 0.15s, background-color 0.15s;
|
||||
|
|
@ -183,6 +184,7 @@
|
|||
gap: 10px;
|
||||
background: var(--bg-deep);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
|
@ -190,7 +192,7 @@
|
|||
display: flex;
|
||||
width: 100%;
|
||||
height: 18px;
|
||||
background: rgba(25, 32, 46, 0.8);
|
||||
background: var(--bg-elevated);
|
||||
border: 1px solid var(--border);
|
||||
overflow: hidden;
|
||||
border-radius: 2px;
|
||||
|
|
@ -216,6 +218,7 @@
|
|||
.bus-power-cell {
|
||||
background: var(--bg-deep);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
padding: 7px 9px;
|
||||
display: flex;
|
||||
|
|
@ -254,32 +257,6 @@
|
|||
#notif-drawer-root {
|
||||
position: static;
|
||||
}
|
||||
.comfort-pill-bar {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
.comfort-btn {
|
||||
padding: 6px 10px;
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
background: var(--bg-panel-solid);
|
||||
border: 1px solid var(--border-bright);
|
||||
color: var(--text-dim);
|
||||
clip-path: var(--chamfer-sm);
|
||||
cursor: pointer;
|
||||
}
|
||||
.comfort-btn:hover {
|
||||
border-color: var(--sim-accent);
|
||||
color: var(--text);
|
||||
}
|
||||
.comfort-btn.active {
|
||||
border-color: var(--brand-blue);
|
||||
color: var(--brand-blue);
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.wiki-drawer-overlay {
|
||||
z-index: 190;
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@
|
|||
.menu-brand-pill {
|
||||
font-family: var(--mono); font-size: 10px; letter-spacing: 0.25em;
|
||||
text-transform: uppercase; color: var(--brand-blue);
|
||||
border: 1px solid var(--sim-accent-dim); background: rgba(11, 14, 20, 0.75);
|
||||
padding: 5px 14px; margin-bottom: 18px; clip-path: var(--chamfer-sm);
|
||||
border: 1px solid var(--sim-accent-dim); background: var(--badge-bg);
|
||||
padding: 5px 14px; margin-bottom: 18px; border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
}
|
||||
.menu-title {
|
||||
font-family: var(--mono);
|
||||
font-size: clamp(32px, 5.5vw, 66px);
|
||||
font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
|
||||
text-align: center; color: #f8fafc;
|
||||
text-shadow: 0 0 36px var(--sim-glow), 0 0 12px rgba(52, 152, 219, 0.35);
|
||||
text-align: center; color: var(--title-color);
|
||||
text-shadow: 0 0 36px var(--sim-glow), 0 0 12px var(--sim-accent-dim);
|
||||
}
|
||||
.menu-title::after {
|
||||
content: ''; display: block; height: 2px; margin: 12px auto 0; width: 72%;
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
.onboard-preview { display: flex; flex-direction: column; gap: 12px; }
|
||||
.onboard-preview-box {
|
||||
height: 280px; position: relative; border: 1px solid var(--border);
|
||||
background: var(--bg-deep); clip-path: var(--chamfer-sm); overflow: hidden;
|
||||
background: var(--bg-deep); border-radius: var(--radius-sm); clip-path: var(--chamfer-sm); overflow: hidden;
|
||||
}
|
||||
|
||||
.dash-root { display: grid; grid-template-columns: 1fr 370px; height: 100%; }
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
position: absolute; top: 0; left: 0; right: 0;
|
||||
display: flex; justify-content: space-between; align-items: center; gap: 12px;
|
||||
padding: 14px 20px; z-index: 5;
|
||||
background: linear-gradient(180deg, rgba(11, 14, 20, 0.92), transparent);
|
||||
background: linear-gradient(180deg, var(--bg-header-fade), transparent);
|
||||
pointer-events: none;
|
||||
}
|
||||
.dash-header > * { pointer-events: auto; }
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
.stat-row {
|
||||
display: flex; justify-content: space-between; align-items: center; gap: 8px;
|
||||
font-size: 12px; padding: 6px 0; border-bottom: 1px solid rgba(42, 52, 73, 0.55);
|
||||
font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle);
|
||||
font-family: var(--mono);
|
||||
}
|
||||
.stat-row .k { color: var(--text-dim); text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; }
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
display: flex; gap: 6px; padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--border); background: var(--bg-deep); align-items: center;
|
||||
}
|
||||
.builder-tabs { display: flex; border-bottom: 1px solid var(--border); background: rgba(11, 14, 20, 0.5); }
|
||||
.builder-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg-inset); }
|
||||
.builder-tabs button {
|
||||
flex: 1; padding: 11px 6px; background: none; border: none; color: var(--text-dim);
|
||||
font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
|
||||
|
|
@ -119,13 +119,14 @@
|
|||
.builder-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
|
||||
|
||||
.stage-card {
|
||||
border: 1px solid var(--border); clip-path: var(--chamfer-sm);
|
||||
border: 1px solid var(--border); border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
padding: 12px; background: var(--bg-elevated); display: flex; flex-direction: column; gap: 9px;
|
||||
}
|
||||
.stage-card.active { border-color: var(--brand-blue); }
|
||||
|
||||
.slot-group {
|
||||
background: rgba(11, 14, 20, 0.55); border: 1px solid var(--border);
|
||||
background: var(--bg-inset); border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 8px 10px; display: flex; flex-direction: column; gap: 6px;
|
||||
}
|
||||
.slot-title {
|
||||
|
|
@ -134,7 +135,7 @@
|
|||
}
|
||||
|
||||
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
|
||||
.stat-box { background: var(--bg-deep); border: 1px solid var(--border); clip-path: var(--chamfer-sm); padding: 9px 11px; }
|
||||
.stat-box { background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); clip-path: var(--chamfer-sm); padding: 9px 11px; }
|
||||
.stat-box .k { font-family: var(--mono); font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; }
|
||||
.stat-box .v { font-family: var(--mono); font-size: 13px; margin-top: 3px; font-weight: 700; }
|
||||
.stat-box .v.good { color: var(--green); }
|
||||
|
|
@ -143,7 +144,7 @@
|
|||
|
||||
.rule-item {
|
||||
border: 1px solid var(--border); padding: 8px 10px; background: var(--bg-deep);
|
||||
clip-path: var(--chamfer-sm); display: flex; flex-direction: column; gap: 4px; font-size: 11px;
|
||||
border-radius: var(--radius-sm); clip-path: var(--chamfer-sm); display: flex; flex-direction: column; gap: 4px; font-size: 11px;
|
||||
}
|
||||
.rule-item.fail { border-color: rgba(248, 113, 113, 0.5); }
|
||||
.rule-item.waived { border-color: rgba(245, 158, 11, 0.55); }
|
||||
|
|
@ -163,7 +164,7 @@
|
|||
}
|
||||
.canvas-box {
|
||||
width: 100%; background: var(--bg-deep); border: 1px solid var(--border);
|
||||
clip-path: var(--chamfer-sm); display: block;
|
||||
border-radius: var(--radius-sm); clip-path: var(--chamfer-sm); display: block;
|
||||
}
|
||||
|
||||
.map-root { display: grid; grid-template-columns: 1fr 340px; height: 100%; }
|
||||
|
|
@ -187,14 +188,14 @@
|
|||
}
|
||||
.launch-hud-stack > * { pointer-events: auto; }
|
||||
.launch-hud {
|
||||
background: rgba(11, 14, 20, 0.88); backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border); clip-path: var(--chamfer);
|
||||
background: var(--bg-glass); backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border); border-radius: var(--radius-panel); clip-path: var(--chamfer);
|
||||
padding: 14px 16px; min-width: 310px; width: min(335px, calc(100vw - 40px));
|
||||
font-family: var(--mono); font-size: 11px;
|
||||
}
|
||||
.launch-events {
|
||||
background: rgba(11, 14, 20, 0.86); backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border); clip-path: var(--chamfer-sm);
|
||||
background: var(--bg-glass); backdrop-filter: blur(8px);
|
||||
border: 1px solid var(--border); border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
padding: 12px 14px; width: min(335px, calc(100vw - 40px));
|
||||
max-height: 185px; overflow-y: auto;
|
||||
font-family: var(--mono); font-size: 11px;
|
||||
|
|
@ -240,7 +241,7 @@
|
|||
}
|
||||
.wiki-nav-item {
|
||||
display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%;
|
||||
padding: 8px 10px; background: transparent; border: 1px solid transparent; clip-path: var(--chamfer-sm);
|
||||
padding: 8px 10px; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
color: var(--text-dim); font-family: var(--mono); font-size: 11px; text-align: left; cursor: pointer;
|
||||
transition: background-color 0.14s, border-color 0.14s, color 0.14s;
|
||||
}
|
||||
|
|
@ -248,7 +249,7 @@
|
|||
.wiki-nav-item.active { background: var(--sim-glow); color: var(--sim-accent); border-color: var(--sim-accent); }
|
||||
.wiki-search-hit {
|
||||
display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 8px 10px;
|
||||
background: var(--bg-deep); border: 1px solid var(--border); clip-path: var(--chamfer-sm);
|
||||
background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
color: var(--text); text-align: left; cursor: pointer;
|
||||
}
|
||||
.wiki-search-hit:hover { border-color: var(--sim-accent); background: var(--bg-elevated); }
|
||||
|
|
@ -260,7 +261,7 @@
|
|||
.wiki-callout {
|
||||
display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px;
|
||||
background: rgba(52, 211, 153, 0.08); border: 1px solid rgba(52, 211, 153, 0.35);
|
||||
clip-path: var(--chamfer-sm); color: var(--text);
|
||||
border-radius: var(--radius-sm); clip-path: var(--chamfer-sm); color: var(--text);
|
||||
}
|
||||
.wiki-section { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
|
||||
.wiki-prose { font-size: 13px; line-height: 1.62; color: var(--text-dim); }
|
||||
|
|
@ -270,13 +271,13 @@
|
|||
}
|
||||
.wiki-formula {
|
||||
padding: 8px 12px; background: var(--bg-deep); border: 1px solid var(--border-bright);
|
||||
clip-path: var(--chamfer-sm); font-family: var(--mono); font-size: 12px; color: var(--brand-blue);
|
||||
border-radius: var(--radius-sm); clip-path: var(--chamfer-sm); font-family: var(--mono); font-size: 12px; color: var(--brand-blue);
|
||||
}
|
||||
.wiki-lab-card { padding: 16px 18px; }
|
||||
.wiki-lab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
|
||||
.wiki-checklist-item {
|
||||
padding: 10px 12px; background: var(--bg-deep); border: 1px solid var(--border);
|
||||
clip-path: var(--chamfer-sm); transition: border-color 0.15s;
|
||||
border-radius: var(--radius-sm); clip-path: var(--chamfer-sm); transition: border-color 0.15s;
|
||||
}
|
||||
.wiki-checklist-item.done { border-color: rgba(52, 211, 153, 0.45); }
|
||||
.wiki-glossary-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
|
||||
|
|
@ -285,7 +286,7 @@
|
|||
.wiki-ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
|
||||
.wiki-ref-card {
|
||||
display: block; text-decoration: none; color: inherit; padding: 12px 14px;
|
||||
background: var(--bg-panel-solid); border: 1px solid var(--border); clip-path: var(--chamfer-sm);
|
||||
background: var(--bg-panel-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); clip-path: var(--chamfer-sm);
|
||||
transition: border-color 0.15s, background-color 0.15s;
|
||||
}
|
||||
.wiki-ref-card:hover { border-color: var(--brand-blue); background: var(--bg-elevated); }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,208 @@
|
|||
/* Daylight light mode overrides (for the blind), reduce-effecties mode (for the not-blind), and terminology tooltips (I needed that). */
|
||||
:root[data-color-mode="light"] {
|
||||
/* Modular Theme System: Shape-Sets, Color-Sets, Comfort Toggles, Theme Modal UI, and Terminology Tooltips */
|
||||
|
||||
/* ============================================================================
|
||||
1. SHAPE-SETS (chamfered | smooth | sharp)
|
||||
============================================================================ */
|
||||
:root[data-shape-set="smooth"] {
|
||||
--chamfer: none;
|
||||
--chamfer-sm: none;
|
||||
--radius-panel: 8px;
|
||||
--radius-sm: 4px;
|
||||
}
|
||||
|
||||
:root[data-shape-set="sharp"] {
|
||||
--chamfer: none;
|
||||
--chamfer-sm: none;
|
||||
--radius-panel: 0px;
|
||||
--radius-sm: 0px;
|
||||
}
|
||||
|
||||
:root[data-shape-set="smooth"] .panel,
|
||||
:root[data-shape-set="smooth"] .launch-hud,
|
||||
:root[data-shape-set="smooth"] .walkthrough-card,
|
||||
:root[data-shape-set="sharp"] .panel,
|
||||
:root[data-shape-set="sharp"] .launch-hud,
|
||||
:root[data-shape-set="sharp"] .walkthrough-card {
|
||||
clip-path: none !important;
|
||||
border-radius: var(--radius-panel);
|
||||
}
|
||||
|
||||
:root[data-shape-set="smooth"] .card,
|
||||
:root[data-shape-set="smooth"] .btn,
|
||||
:root[data-shape-set="smooth"] .input,
|
||||
:root[data-shape-set="smooth"] .badge,
|
||||
:root[data-shape-set="smooth"] .toast,
|
||||
:root[data-shape-set="smooth"] .stat-box,
|
||||
:root[data-shape-set="smooth"] .stage-card,
|
||||
:root[data-shape-set="smooth"] .slot-group,
|
||||
:root[data-shape-set="smooth"] .rule-item,
|
||||
:root[data-shape-set="smooth"] .canvas-box,
|
||||
:root[data-shape-set="smooth"] .launch-events,
|
||||
:root[data-shape-set="smooth"] .notif-toggle-bar,
|
||||
:root[data-shape-set="smooth"] .notif-item,
|
||||
:root[data-shape-set="smooth"] .station-pill,
|
||||
:root[data-shape-set="smooth"] .value-chart,
|
||||
:root[data-shape-set="smooth"] .bus-power-cell,
|
||||
:root[data-shape-set="smooth"] .hud-tooltip,
|
||||
:root[data-shape-set="smooth"] .wiki-nav-item,
|
||||
:root[data-shape-set="smooth"] .wiki-search-hit,
|
||||
:root[data-shape-set="smooth"] .wiki-callout,
|
||||
:root[data-shape-set="smooth"] .wiki-formula,
|
||||
:root[data-shape-set="smooth"] .wiki-checklist-item,
|
||||
:root[data-shape-set="smooth"] .wiki-ref-card,
|
||||
:root[data-shape-set="smooth"] .walkthrough-pill,
|
||||
:root[data-shape-set="smooth"] .menu-brand-pill,
|
||||
:root[data-shape-set="smooth"] .onboard-preview-box,
|
||||
:root[data-shape-set="smooth"] .theme-chip,
|
||||
:root[data-shape-set="smooth"] .theme-preview-card,
|
||||
:root[data-shape-set="sharp"] .card,
|
||||
:root[data-shape-set="sharp"] .btn,
|
||||
:root[data-shape-set="sharp"] .input,
|
||||
:root[data-shape-set="sharp"] .badge,
|
||||
:root[data-shape-set="sharp"] .toast,
|
||||
:root[data-shape-set="sharp"] .stat-box,
|
||||
:root[data-shape-set="sharp"] .stage-card,
|
||||
:root[data-shape-set="sharp"] .slot-group,
|
||||
:root[data-shape-set="sharp"] .rule-item,
|
||||
:root[data-shape-set="sharp"] .canvas-box,
|
||||
:root[data-shape-set="sharp"] .launch-events,
|
||||
:root[data-shape-set="sharp"] .notif-toggle-bar,
|
||||
:root[data-shape-set="sharp"] .notif-item,
|
||||
:root[data-shape-set="sharp"] .station-pill,
|
||||
:root[data-shape-set="sharp"] .value-chart,
|
||||
:root[data-shape-set="sharp"] .bus-power-cell,
|
||||
:root[data-shape-set="sharp"] .hud-tooltip,
|
||||
:root[data-shape-set="sharp"] .wiki-nav-item,
|
||||
:root[data-shape-set="sharp"] .wiki-search-hit,
|
||||
:root[data-shape-set="sharp"] .wiki-callout,
|
||||
:root[data-shape-set="sharp"] .wiki-formula,
|
||||
:root[data-shape-set="sharp"] .wiki-checklist-item,
|
||||
:root[data-shape-set="sharp"] .wiki-ref-card,
|
||||
:root[data-shape-set="sharp"] .walkthrough-pill,
|
||||
:root[data-shape-set="sharp"] .menu-brand-pill,
|
||||
:root[data-shape-set="sharp"] .onboard-preview-box,
|
||||
:root[data-shape-set="sharp"] .theme-chip,
|
||||
:root[data-shape-set="sharp"] .theme-preview-card {
|
||||
clip-path: none !important;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
2. NAMED COLOR-SETS (eyebleed uses :root defaults in tokens.css)
|
||||
============================================================================ */
|
||||
:root[data-color-set="subtle"] {
|
||||
--bg-deep: #10141c;
|
||||
--bg-panel: rgba(22, 27, 36, 0.96);
|
||||
--bg-panel-solid: #161b24;
|
||||
--bg-elevated: #1e2531;
|
||||
--bg-hover: #273040;
|
||||
--border: #2b3444;
|
||||
--border-bright: #3c485e;
|
||||
--border-subtle: rgba(43, 52, 68, 0.55);
|
||||
--text: #d5dde8;
|
||||
--text-dim: #8b9ab0;
|
||||
--text-faint: #627084;
|
||||
--brand-blue: #648bb8;
|
||||
--brand-strong: #4a6f99;
|
||||
--sim-accent: #648bb8;
|
||||
--sim-accent-dim: rgba(100, 139, 184, 0.24);
|
||||
--sim-glow: rgba(100, 139, 184, 0.08);
|
||||
--green: #47a885;
|
||||
--amber: #c98e3b;
|
||||
--red: #c96b6b;
|
||||
--violet: #8b7cc8;
|
||||
--bg-glass: rgba(22, 27, 36, 0.95);
|
||||
--bg-inset: rgba(16, 20, 28, 0.72);
|
||||
--bg-header-fade: rgba(16, 20, 28, 0.92);
|
||||
--badge-bg: rgba(16, 20, 28, 0.78);
|
||||
--btn-primary-bg: rgba(100, 139, 184, 0.18);
|
||||
--btn-primary-hover: rgba(100, 139, 184, 0.30);
|
||||
--btn-primary-text: #dce7f5;
|
||||
--btn-warn-bg: rgba(201, 142, 59, 0.14);
|
||||
--btn-warn-text: #ecd3a5;
|
||||
--btn-danger-bg: rgba(201, 107, 107, 0.12);
|
||||
--btn-danger-text: #ebc4c4;
|
||||
--btn-ghost-bg: rgba(22, 27, 36, 0.72);
|
||||
--title-color: #e2e8f0;
|
||||
--grid-line-color: rgba(148, 163, 184, 0.015);
|
||||
}
|
||||
|
||||
:root[data-color-set="low-contrast"] {
|
||||
--bg-deep: #191d26;
|
||||
--bg-panel: rgba(32, 37, 48, 0.96);
|
||||
--bg-panel-solid: #202530;
|
||||
--bg-elevated: #272d3a;
|
||||
--bg-hover: #303747;
|
||||
--border: #343c4d;
|
||||
--border-bright: #465066;
|
||||
--border-subtle: rgba(52, 60, 77, 0.6);
|
||||
--text: #b3becf;
|
||||
--text-dim: #838fa3;
|
||||
--text-faint: #626d80;
|
||||
--brand-blue: #6d90ba;
|
||||
--brand-strong: #55769e;
|
||||
--sim-accent: #6d90ba;
|
||||
--sim-accent-dim: rgba(109, 144, 186, 0.24);
|
||||
--sim-glow: rgba(109, 144, 186, 0.10);
|
||||
--green: #5fa88d;
|
||||
--amber: #c2944c;
|
||||
--red: #c47678;
|
||||
--violet: #9182c4;
|
||||
--bg-glass: rgba(32, 37, 48, 0.94);
|
||||
--bg-inset: rgba(25, 29, 38, 0.72);
|
||||
--bg-header-fade: rgba(25, 29, 38, 0.9);
|
||||
--badge-bg: rgba(25, 29, 38, 0.78);
|
||||
--btn-primary-bg: rgba(109, 144, 186, 0.20);
|
||||
--btn-primary-hover: rgba(109, 144, 186, 0.32);
|
||||
--btn-primary-text: #ccd8e8;
|
||||
--btn-warn-bg: rgba(194, 148, 76, 0.15);
|
||||
--btn-warn-text: #dfcca8;
|
||||
--btn-danger-bg: rgba(196, 118, 120, 0.14);
|
||||
--btn-danger-text: #e0babc;
|
||||
--btn-ghost-bg: rgba(32, 37, 48, 0.7);
|
||||
--title-color: #c7d1e0;
|
||||
--grid-line-color: rgba(179, 190, 207, 0.02);
|
||||
}
|
||||
|
||||
:root[data-color-set="catppuccin-mocha"] {
|
||||
--bg-deep: #1e1e2e;
|
||||
--bg-panel: rgba(24, 24, 37, 0.94);
|
||||
--bg-panel-solid: #181825;
|
||||
--bg-elevated: #313244;
|
||||
--bg-hover: #45475a;
|
||||
--border: #45475a;
|
||||
--border-bright: #585b70;
|
||||
--border-subtle: rgba(69, 71, 90, 0.65);
|
||||
--text: #cdd6f4;
|
||||
--text-dim: #a6adc8;
|
||||
--text-faint: #6c7086;
|
||||
--brand-blue: #89b4fa;
|
||||
--brand-strong: #74c7ec;
|
||||
--sim-accent: #89b4fa;
|
||||
--sim-accent-dim: rgba(137, 180, 250, 0.28);
|
||||
--sim-glow: rgba(116, 199, 236, 0.16);
|
||||
--green: #a6e3a1;
|
||||
--amber: #f9e2af;
|
||||
--red: #f38ba8;
|
||||
--violet: #cba6f7;
|
||||
--bg-glass: rgba(24, 24, 37, 0.92);
|
||||
--bg-inset: rgba(17, 17, 27, 0.7);
|
||||
--bg-header-fade: rgba(17, 17, 27, 0.92);
|
||||
--overlay-scrim: rgba(17, 17, 27, 0.84);
|
||||
--badge-bg: rgba(17, 17, 27, 0.78);
|
||||
--btn-primary-bg: rgba(137, 180, 250, 0.20);
|
||||
--btn-primary-hover: rgba(137, 180, 250, 0.34);
|
||||
--btn-primary-text: #dce8ff;
|
||||
--btn-warn-bg: rgba(249, 226, 175, 0.15);
|
||||
--btn-warn-text: #f9e2af;
|
||||
--btn-danger-bg: rgba(243, 139, 168, 0.15);
|
||||
--btn-danger-text: #f38ba8;
|
||||
--btn-ghost-bg: rgba(24, 24, 37, 0.7);
|
||||
--title-color: #cdd6f4;
|
||||
--grid-line-color: rgba(166, 173, 200, 0.035);
|
||||
}
|
||||
|
||||
:root[data-color-set="daylight"] {
|
||||
--bg-deep: #f1f5f9;
|
||||
--bg-panel: rgba(255, 255, 255, 0.96);
|
||||
--bg-panel-solid: #ffffff;
|
||||
|
|
@ -7,6 +210,7 @@
|
|||
--bg-hover: #cbd5e1;
|
||||
--border: #cbd5e1;
|
||||
--border-bright: #94a3b8;
|
||||
--border-subtle: rgba(148, 163, 184, 0.45);
|
||||
--text: #0f172a;
|
||||
--text-dim: #475569;
|
||||
--text-faint: #64748b;
|
||||
|
|
@ -19,113 +223,220 @@
|
|||
--amber: #d97706;
|
||||
--red: #dc2626;
|
||||
--violet: #7c3aed;
|
||||
--bg-glass: rgba(255, 255, 255, 0.95);
|
||||
--bg-inset: #f8fafc;
|
||||
--bg-header-fade: transparent;
|
||||
--overlay-scrim: rgba(15, 23, 42, 0.42);
|
||||
--badge-bg: #f8fafc;
|
||||
--btn-primary-bg: #0284c7;
|
||||
--btn-primary-hover: #0369a1;
|
||||
--btn-primary-text: #ffffff;
|
||||
--btn-warn-bg: rgba(217, 119, 6, 0.14);
|
||||
--btn-warn-text: #92400e;
|
||||
--btn-danger-bg: rgba(220, 38, 38, 0.12);
|
||||
--btn-danger-text: #991b1b;
|
||||
--btn-ghost-bg: #ffffff;
|
||||
--title-color: #0f172a;
|
||||
--grid-line-color: rgba(15, 23, 42, 0.03);
|
||||
--shadow-elevated: 0 4px 14px rgba(15, 23, 42, 0.12);
|
||||
--shadow-modal: 0 8px 24px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
|
||||
:root[data-color-mode="light"] body::before {
|
||||
background-image:
|
||||
radial-gradient(circle at 50% 10%, rgba(2, 132, 199, 0.08), transparent 60%),
|
||||
linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
|
||||
:root[data-surface-polarity="light"] {
|
||||
--grid-line-color: rgba(15, 23, 42, 0.03);
|
||||
--shadow-elevated: 0 4px 14px rgba(15, 23, 42, 0.12);
|
||||
--shadow-modal: 0 8px 24px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
:root[data-color-mode="light"] .menu-title {
|
||||
color: #0f172a;
|
||||
:root[data-surface-polarity="light"] .menu-title {
|
||||
text-shadow: none;
|
||||
}
|
||||
:root[data-color-mode="light"] .menu-brand-pill {
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
color: #0369a1;
|
||||
:root[data-surface-polarity="light"] .dash-header {
|
||||
background: none;
|
||||
}
|
||||
:root[data-color-mode="light"] .btn.primary {
|
||||
background: #0284c7;
|
||||
border-color: #0369a1;
|
||||
color: #ffffff;
|
||||
}
|
||||
:root[data-color-mode="light"] .btn.primary:hover:not(:disabled) {
|
||||
background: #0369a1;
|
||||
color: #ffffff;
|
||||
}
|
||||
:root[data-color-mode="light"] .btn.warn {
|
||||
background: rgba(217, 119, 6, 0.14);
|
||||
color: #92400e;
|
||||
}
|
||||
:root[data-color-mode="light"] .btn.danger {
|
||||
background: rgba(220, 38, 38, 0.12);
|
||||
color: #991b1b;
|
||||
}
|
||||
:root[data-color-mode="light"] .btn.ghost {
|
||||
background: #ffffff;
|
||||
border-color: #cbd5e1;
|
||||
color: #475569;
|
||||
}
|
||||
:root[data-color-mode="light"] .badge {
|
||||
background: #f8fafc;
|
||||
}
|
||||
:root[data-color-mode="light"] .dash-header {
|
||||
background: linear-gradient(180deg, rgba(241, 245, 249, 0.94), transparent);
|
||||
}
|
||||
:root[data-color-mode="light"] .builder-tabs,
|
||||
:root[data-color-mode="light"] .slot-group,
|
||||
:root[data-color-mode="light"] .builder-summary-bar,
|
||||
:root[data-color-mode="light"] .builder-coop-bar {
|
||||
background: #f8fafc;
|
||||
}
|
||||
:root[data-color-mode="light"] .launch-hud,
|
||||
:root[data-color-mode="light"] .launch-events,
|
||||
:root[data-color-mode="light"] .notif-toggle-bar,
|
||||
:root[data-color-mode="light"] .notif-mini-pill {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
|
||||
}
|
||||
:root[data-color-mode="light"] .modal-overlay {
|
||||
background: rgba(15, 23, 42, 0.42);
|
||||
}
|
||||
:root[data-color-mode="light"] .value-bar-track {
|
||||
background: #e2e8f0;
|
||||
:root[data-surface-polarity="light"] .dash-header h1,
|
||||
:root[data-surface-polarity="light"] .dash-header .mono.dim {
|
||||
background: var(--badge-bg);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
padding: 3px 8px;
|
||||
}
|
||||
|
||||
:root.reduced-effects {
|
||||
--chamfer: none;
|
||||
--chamfer-sm: none;
|
||||
/* ============================================================================
|
||||
3. COMFORT TOGGLES (UI Glows/Blur/Grid vs Animations/Motion)
|
||||
============================================================================ */
|
||||
:root.reduced-ui-effects,
|
||||
:root.reduced-ui-effects body[data-dynamic-theme] {
|
||||
--sim-glow: transparent;
|
||||
}
|
||||
:root.reduced-effects body::before {
|
||||
:root.reduced-ui-effects body::before {
|
||||
background-image: none !important;
|
||||
}
|
||||
:root.reduced-effects *,
|
||||
:root.reduced-effects *::before,
|
||||
:root.reduced-effects *::after {
|
||||
:root.reduced-ui-effects *,
|
||||
:root.reduced-ui-effects *::before,
|
||||
:root.reduced-ui-effects *::after {
|
||||
text-shadow: none !important;
|
||||
box-shadow: none !important;
|
||||
backdrop-filter: none !important;
|
||||
-webkit-backdrop-filter: none !important;
|
||||
}
|
||||
|
||||
:root.reduced-motion-effects *,
|
||||
:root.reduced-motion-effects *::before,
|
||||
:root.reduced-motion-effects *::after {
|
||||
animation: none !important;
|
||||
transition-duration: 0.05s !important;
|
||||
}
|
||||
:root.reduced-effects .panel,
|
||||
:root.reduced-effects .card,
|
||||
:root.reduced-effects .btn,
|
||||
:root.reduced-effects .input,
|
||||
:root.reduced-effects .badge,
|
||||
:root.reduced-effects .stat-box,
|
||||
:root.reduced-effects .stage-card,
|
||||
:root.reduced-effects .rule-item,
|
||||
:root.reduced-effects .launch-hud,
|
||||
:root.reduced-effects .launch-events,
|
||||
:root.reduced-effects .comfort-btn,
|
||||
:root.reduced-effects .notif-toggle-bar,
|
||||
:root.reduced-effects .hud-tooltip,
|
||||
:root.reduced-effects .wiki-nav-item,
|
||||
:root.reduced-effects .wiki-search-hit,
|
||||
:root.reduced-effects .wiki-callout,
|
||||
:root.reduced-effects .wiki-formula,
|
||||
:root.reduced-effects .wiki-checklist-item,
|
||||
:root.reduced-effects .wiki-ref-card,
|
||||
:root.reduced-effects .walkthrough-card,
|
||||
:root.reduced-effects .walkthrough-pill {
|
||||
clip-path: none !important;
|
||||
border-radius: 4px;
|
||||
|
||||
/* ============================================================================
|
||||
4. THEME SETTINGS MODAL UI
|
||||
============================================================================ */
|
||||
.theme-modal {
|
||||
width: min(720px, 100%);
|
||||
max-height: 88vh;
|
||||
}
|
||||
.theme-sections {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
.theme-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
background: var(--bg-inset);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
.theme-section-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.theme-chip-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
.theme-chip {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
padding: 9px 11px;
|
||||
background: var(--bg-panel-solid);
|
||||
border: 1px solid var(--border);
|
||||
clip-path: var(--chamfer-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--text);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.14s ease, background-color 0.14s ease;
|
||||
}
|
||||
.theme-chip:hover {
|
||||
border-color: var(--sim-accent);
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
.theme-chip.active {
|
||||
border-color: var(--sim-accent);
|
||||
background: var(--bg-elevated);
|
||||
box-shadow: inset 0 0 12px var(--sim-glow);
|
||||
}
|
||||
.theme-chip-title {
|
||||
font-family: var(--mono);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
.theme-chip-sub {
|
||||
font-size: 10px;
|
||||
color: var(--text-dim);
|
||||
line-height: 1.35;
|
||||
}
|
||||
.theme-swatches {
|
||||
display: flex;
|
||||
gap: 3px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.theme-swatch {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border: 1px solid var(--border-bright);
|
||||
border-radius: 2px;
|
||||
}
|
||||
.theme-gradient-preview {
|
||||
height: 44px;
|
||||
border: 1px solid var(--border-bright);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
.theme-stops-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
.theme-color-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
.theme-color-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 6px 8px;
|
||||
background: var(--bg-panel-solid);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
.theme-color-label {
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
color: var(--text-dim);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.theme-color-picker-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.theme-color-input {
|
||||
width: 28px;
|
||||
height: 22px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border-bright);
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
.theme-color-hex {
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
color: var(--text);
|
||||
min-width: 56px;
|
||||
}
|
||||
.theme-preview-card {
|
||||
padding: 12px 14px;
|
||||
background-color: var(--bg-panel);
|
||||
background-image: var(--panel-gradient);
|
||||
border: 1px solid var(--border);
|
||||
clip-path: var(--chamfer-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* ============================================================================
|
||||
5. TERMINOLOGY TOOLTIPS
|
||||
============================================================================ */
|
||||
.term-wrap {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
|
@ -142,7 +453,7 @@
|
|||
padding: 0;
|
||||
border-radius: 50%;
|
||||
border: 1px solid var(--border-bright);
|
||||
background: rgba(15, 23, 42, 0.72);
|
||||
background: var(--bg-elevated);
|
||||
color: var(--text-dim);
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
|
|
@ -156,7 +467,7 @@
|
|||
.tip-badge:focus-visible {
|
||||
color: var(--sim-accent);
|
||||
border-color: var(--sim-accent);
|
||||
background: rgba(96, 165, 250, 0.16);
|
||||
background: var(--sim-glow);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
|
@ -167,8 +478,9 @@
|
|||
padding: 9px 11px;
|
||||
background: var(--bg-panel-solid);
|
||||
border: 1px solid var(--sim-accent);
|
||||
border-radius: var(--radius-sm);
|
||||
clip-path: var(--chamfer-sm);
|
||||
box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 14px var(--sim-glow);
|
||||
box-shadow: var(--shadow-modal), 0 0 14px var(--sim-glow);
|
||||
pointer-events: none;
|
||||
color: var(--text);
|
||||
font-family: var(--sans);
|
||||
|
|
@ -209,31 +521,9 @@
|
|||
margin-top: 6px;
|
||||
padding: 4px 6px;
|
||||
border-radius: 3px;
|
||||
background: rgba(15, 23, 42, 0.75);
|
||||
background: var(--bg-deep);
|
||||
border: 1px solid var(--border);
|
||||
font-family: var(--mono);
|
||||
font-size: 10px;
|
||||
color: var(--brand-blue);
|
||||
}
|
||||
|
||||
:root[data-color-mode="light"] .tip-badge {
|
||||
background: #e2e8f0;
|
||||
border-color: #94a3b8;
|
||||
color: #334155;
|
||||
}
|
||||
:root[data-color-mode="light"] .tip-badge:hover,
|
||||
:root[data-color-mode="light"] .tip-badge:focus-visible {
|
||||
background: rgba(2, 132, 199, 0.14);
|
||||
border-color: #0284c7;
|
||||
color: #0369a1;
|
||||
}
|
||||
:root[data-color-mode="light"] .hud-tooltip {
|
||||
background: #ffffff;
|
||||
border-color: #0284c7;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
|
||||
}
|
||||
:root[data-color-mode="light"] .hud-tooltip-formula {
|
||||
background: #f1f5f9;
|
||||
border-color: #cbd5e1;
|
||||
color: #0369a1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
--bg-hover: #212a3c;
|
||||
--border: #2a3449;
|
||||
--border-bright: #3d4d6b;
|
||||
--border-subtle: rgba(42, 52, 73, 0.55);
|
||||
--text: #e2e8f0;
|
||||
--text-dim: #94a3b8;
|
||||
--text-faint: #64748b;
|
||||
|
|
@ -19,64 +20,86 @@
|
|||
--amber: #f59e0b;
|
||||
--red: #f87171;
|
||||
--violet: #a78bfa;
|
||||
|
||||
--bg-glass: rgba(18, 22, 31, 0.9);
|
||||
--bg-inset: rgba(11, 14, 20, 0.65);
|
||||
--bg-header-fade: rgba(11, 14, 20, 0.92);
|
||||
--overlay-scrim: rgba(7, 10, 15, 0.84);
|
||||
--badge-bg: rgba(11, 14, 20, 0.72);
|
||||
--btn-primary-bg: rgba(52, 152, 219, 0.18);
|
||||
--btn-primary-hover: rgba(52, 152, 219, 0.34);
|
||||
--btn-primary-text: #dbeafe;
|
||||
--btn-warn-bg: rgba(245, 158, 11, 0.15);
|
||||
--btn-warn-text: #fde68a;
|
||||
--btn-danger-bg: rgba(248, 113, 113, 0.12);
|
||||
--btn-danger-text: #fecaca;
|
||||
--btn-ghost-bg: rgba(18, 22, 31, 0.65);
|
||||
--title-color: #f8fafc;
|
||||
--grid-line-color: rgba(148, 163, 184, 0.03);
|
||||
--bg-gradient: none;
|
||||
--panel-gradient: none;
|
||||
--shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.45);
|
||||
--shadow-modal: 0 12px 32px rgba(0, 0, 0, 0.6);
|
||||
|
||||
--mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
|
||||
--sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
|
||||
--chamfer: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
|
||||
--chamfer-sm: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
|
||||
--radius-panel: 0px;
|
||||
--radius-sm: 0px;
|
||||
}
|
||||
|
||||
body[data-target="lunar"], body[data-target="moon-landing"] {
|
||||
body[data-dynamic-theme="on"][data-target="lunar"],
|
||||
body[data-dynamic-theme="on"][data-target="moon-landing"] {
|
||||
--sim-accent: #93c5fd;
|
||||
--sim-accent-dim: rgba(147, 197, 253, 0.26);
|
||||
--sim-glow: rgba(147, 197, 253, 0.14);
|
||||
}
|
||||
body[data-target="mars"] {
|
||||
body[data-dynamic-theme="on"][data-target="mars"] {
|
||||
--sim-accent: #fb923c;
|
||||
--sim-accent-dim: rgba(251, 146, 60, 0.28);
|
||||
--sim-glow: rgba(251, 146, 60, 0.14);
|
||||
}
|
||||
body[data-target="jupiter"], body[data-target="asteroid"] {
|
||||
body[data-dynamic-theme="on"][data-target="jupiter"],
|
||||
body[data-dynamic-theme="on"][data-target="asteroid"] {
|
||||
--sim-accent: #a78bfa;
|
||||
--sim-accent-dim: rgba(167, 139, 250, 0.28);
|
||||
--sim-glow: rgba(167, 139, 250, 0.14);
|
||||
}
|
||||
body[data-target="solar"], body[data-target="l1"] {
|
||||
body[data-dynamic-theme="on"][data-target="solar"],
|
||||
body[data-dynamic-theme="on"][data-target="l1"] {
|
||||
--sim-accent: #fbbf24;
|
||||
--sim-accent-dim: rgba(251, 191, 36, 0.28);
|
||||
--sim-glow: rgba(251, 191, 36, 0.14);
|
||||
}
|
||||
|
||||
body[data-weather="solar-wind"] {
|
||||
body[data-dynamic-theme="on"][data-weather="solar-wind"] {
|
||||
--sim-accent: #38bdf8;
|
||||
--sim-accent-dim: rgba(56, 189, 248, 0.30);
|
||||
--sim-glow: rgba(56, 189, 248, 0.16);
|
||||
}
|
||||
body[data-weather="solar-storm"] {
|
||||
body[data-dynamic-theme="on"][data-weather="solar-storm"] {
|
||||
--sim-accent: #f59e0b;
|
||||
--sim-accent-dim: rgba(245, 158, 11, 0.34);
|
||||
--sim-glow: rgba(245, 158, 11, 0.18);
|
||||
}
|
||||
body[data-weather="radiation-storm"] {
|
||||
body[data-dynamic-theme="on"][data-weather="radiation-storm"] {
|
||||
--sim-accent: #f87171;
|
||||
--sim-accent-dim: rgba(248, 113, 113, 0.34);
|
||||
--sim-glow: rgba(248, 113, 113, 0.18);
|
||||
}
|
||||
body[data-weather="micrometeoroid"] {
|
||||
body[data-dynamic-theme="on"][data-weather="micrometeoroid"] {
|
||||
--sim-accent: #c084fc;
|
||||
--sim-accent-dim: rgba(192, 132, 252, 0.32);
|
||||
--sim-glow: rgba(192, 132, 252, 0.16);
|
||||
}
|
||||
body[data-dynamic-theme="off"] {
|
||||
--sim-accent: var(--brand-blue);
|
||||
--sim-accent-dim: rgba(96, 165, 250, 0.25);
|
||||
--sim-glow: rgba(96, 165, 250, 0.14);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
background: var(--bg-deep);
|
||||
background-color: var(--bg-deep);
|
||||
background-image: var(--bg-gradient);
|
||||
color: var(--text);
|
||||
font-family: var(--sans);
|
||||
font-size: 14px;
|
||||
|
|
@ -89,8 +112,8 @@ body::before {
|
|||
position: fixed; inset: 0; pointer-events: none; z-index: 0;
|
||||
background-image:
|
||||
radial-gradient(circle at 50% 15%, var(--sim-glow), transparent 65%),
|
||||
linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
|
||||
linear-gradient(var(--grid-line-color) 1px, transparent 1px),
|
||||
linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
|
||||
background-size: 100% 100%, 44px 44px, 44px 44px;
|
||||
transition: background 0.6s ease;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Space Gaem: You Will Feel the Pain · GsDistance</title>
|
||||
<style>html, body { margin: 0; padding: 0; background: #0b0e14; color: #e2e8f0; }</style>
|
||||
<style>html, body { margin: 0; padding: 0; background: #1e1e2e; color: #cdd6f4; }</style>
|
||||
<link rel="stylesheet" href="/bundle/style.css" />
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||
</head>
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
<div id="walkthrough-coach-root"></div>
|
||||
<div id="toast-root"></div>
|
||||
<div id="hud-bottom-right">
|
||||
<div id="comfort-controls-root"></div>
|
||||
<div id="notif-drawer-root"></div>
|
||||
</div>
|
||||
<script type="module" src="/bundle/app.js"></script>
|
||||
|
|
|
|||
|
|
@ -5,13 +5,212 @@ import type {
|
|||
SavedRocketBlueprint,
|
||||
} from "../shared/types.js";
|
||||
|
||||
export type ShapeSet = "chamfered" | "smooth" | "sharp";
|
||||
export type ColorSet =
|
||||
| "eyebleed"
|
||||
| "subtle"
|
||||
| "low-contrast"
|
||||
| "catppuccin-mocha"
|
||||
| "daylight"
|
||||
| "gradient"
|
||||
| "custom";
|
||||
|
||||
export interface GradientThemeConfig {
|
||||
stops: string[];
|
||||
angle: number;
|
||||
mode: "linear" | "radial";
|
||||
surfaceBase: "dark" | "light";
|
||||
applyToPanels: boolean;
|
||||
}
|
||||
|
||||
export interface CustomThemeTokens {
|
||||
bgDeep: string;
|
||||
bgPanelSolid: string;
|
||||
bgElevated: string;
|
||||
border: string;
|
||||
text: string;
|
||||
textDim: string;
|
||||
accent: string;
|
||||
glow: string;
|
||||
green: string;
|
||||
amber: string;
|
||||
red: string;
|
||||
violet: string;
|
||||
panelOpacity: number;
|
||||
}
|
||||
|
||||
export interface ThemeConfig {
|
||||
shapeSet: ShapeSet;
|
||||
colorSet: ColorSet;
|
||||
uiEffects: boolean;
|
||||
motionEffects: boolean;
|
||||
dynamicAccent: boolean;
|
||||
gradient: GradientThemeConfig;
|
||||
custom: CustomThemeTokens;
|
||||
}
|
||||
|
||||
export interface ClientSettings {
|
||||
quality: "low" | "medium" | "high";
|
||||
sound: boolean;
|
||||
notifications: boolean;
|
||||
dynamicTheme: boolean;
|
||||
colorMode: "dark" | "light";
|
||||
reducedEffects: boolean;
|
||||
theme: ThemeConfig;
|
||||
}
|
||||
|
||||
interface LegacyClientSettings {
|
||||
quality?: "low" | "medium" | "high";
|
||||
sound?: boolean;
|
||||
notifications?: boolean;
|
||||
dynamicTheme?: boolean;
|
||||
colorMode?: "dark" | "light";
|
||||
reducedEffects?: boolean;
|
||||
theme?: Partial<ThemeConfig>;
|
||||
}
|
||||
|
||||
export const DEFAULT_GRADIENT_CONFIG: GradientThemeConfig = {
|
||||
stops: ["#0b1120", "#172554", "#0f172a"],
|
||||
angle: 135,
|
||||
mode: "linear",
|
||||
surfaceBase: "dark",
|
||||
applyToPanels: true,
|
||||
};
|
||||
|
||||
export const DEFAULT_CUSTOM_TOKENS: CustomThemeTokens = {
|
||||
bgDeep: "#0b0e14",
|
||||
bgPanelSolid: "#12161f",
|
||||
bgElevated: "#19202e",
|
||||
border: "#2a3449",
|
||||
text: "#e2e8f0",
|
||||
textDim: "#94a3b8",
|
||||
accent: "#60a5fa",
|
||||
glow: "#60a5fa",
|
||||
green: "#34d399",
|
||||
amber: "#f59e0b",
|
||||
red: "#f87171",
|
||||
violet: "#a78bfa",
|
||||
panelOpacity: 0.92,
|
||||
};
|
||||
|
||||
export const DEFAULT_THEME_CONFIG: ThemeConfig = {
|
||||
shapeSet: "chamfered",
|
||||
colorSet: "catppuccin-mocha",
|
||||
uiEffects: true,
|
||||
motionEffects: true,
|
||||
dynamicAccent: true,
|
||||
gradient: { ...DEFAULT_GRADIENT_CONFIG, stops: [...DEFAULT_GRADIENT_CONFIG.stops] },
|
||||
custom: { ...DEFAULT_CUSTOM_TOKENS },
|
||||
};
|
||||
|
||||
const VALID_SHAPE_SETS = new Set<ShapeSet>(["chamfered", "smooth", "sharp"]);
|
||||
const VALID_COLOR_SETS = new Set<ColorSet>([
|
||||
"eyebleed",
|
||||
"subtle",
|
||||
"low-contrast",
|
||||
"catppuccin-mocha",
|
||||
"daylight",
|
||||
"gradient",
|
||||
"custom",
|
||||
]);
|
||||
|
||||
function normalizeStoredHex(val: unknown, fallback: string): string {
|
||||
if (typeof val !== "string") return fallback;
|
||||
const trimmed = val.trim();
|
||||
if (/^#[0-9a-fA-F]{6}$/.test(trimmed)) return trimmed.toLowerCase();
|
||||
if (/^#[0-9a-fA-F]{3}$/.test(trimmed)) {
|
||||
const [, r, g, b] = trimmed;
|
||||
return `#${r}${r}${g}${g}${b}${b}`.toLowerCase();
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
export function normalizeThemeConfig(
|
||||
rawTheme?: Partial<ThemeConfig> | null,
|
||||
legacy?: LegacyClientSettings,
|
||||
): ThemeConfig {
|
||||
const legacyReduced = !!legacy?.reducedEffects;
|
||||
const legacyLight = legacy?.colorMode === "light";
|
||||
const legacyDyn = legacy?.dynamicTheme ?? true;
|
||||
|
||||
if (!rawTheme) {
|
||||
return {
|
||||
shapeSet: legacyReduced ? "smooth" : "chamfered",
|
||||
colorSet: legacyLight
|
||||
? "daylight"
|
||||
: legacyReduced
|
||||
? "subtle"
|
||||
: "catppuccin-mocha",
|
||||
uiEffects: !legacyReduced,
|
||||
motionEffects: !legacyReduced,
|
||||
dynamicAccent: legacyReduced ? false : legacyDyn,
|
||||
gradient: {
|
||||
...DEFAULT_GRADIENT_CONFIG,
|
||||
stops: [...DEFAULT_GRADIENT_CONFIG.stops],
|
||||
},
|
||||
custom: { ...DEFAULT_CUSTOM_TOKENS },
|
||||
};
|
||||
}
|
||||
|
||||
const rawGrad = rawTheme.gradient;
|
||||
const rawStops = Array.isArray(rawGrad?.stops)
|
||||
? rawGrad.stops
|
||||
.slice(0, 3)
|
||||
.map((s, idx) =>
|
||||
normalizeStoredHex(s, DEFAULT_GRADIENT_CONFIG.stops[idx] ?? "#0f172a"),
|
||||
)
|
||||
: [...DEFAULT_GRADIENT_CONFIG.stops];
|
||||
while (rawStops.length < 2) {
|
||||
rawStops.push(DEFAULT_GRADIENT_CONFIG.stops[rawStops.length] ?? "#172554");
|
||||
}
|
||||
|
||||
const rawCustom = rawTheme.custom;
|
||||
const angleNum = Number(rawGrad?.angle);
|
||||
const opacityNum = Number(rawCustom?.panelOpacity);
|
||||
|
||||
return {
|
||||
shapeSet: VALID_SHAPE_SETS.has(rawTheme.shapeSet as ShapeSet)
|
||||
? (rawTheme.shapeSet as ShapeSet)
|
||||
: "chamfered",
|
||||
colorSet: VALID_COLOR_SETS.has(rawTheme.colorSet as ColorSet)
|
||||
? (rawTheme.colorSet as ColorSet)
|
||||
: "catppuccin-mocha",
|
||||
uiEffects: rawTheme.uiEffects ?? true,
|
||||
motionEffects: rawTheme.motionEffects ?? true,
|
||||
dynamicAccent: rawTheme.dynamicAccent ?? true,
|
||||
gradient: {
|
||||
stops: rawStops,
|
||||
angle: Number.isFinite(angleNum)
|
||||
? Math.max(0, Math.min(360, Math.round(angleNum)))
|
||||
: DEFAULT_GRADIENT_CONFIG.angle,
|
||||
mode: rawGrad?.mode === "radial" ? "radial" : "linear",
|
||||
surfaceBase: rawGrad?.surfaceBase === "light" ? "light" : "dark",
|
||||
applyToPanels: rawGrad?.applyToPanels ?? true,
|
||||
},
|
||||
custom: {
|
||||
bgDeep: normalizeStoredHex(rawCustom?.bgDeep, DEFAULT_CUSTOM_TOKENS.bgDeep),
|
||||
bgPanelSolid: normalizeStoredHex(
|
||||
rawCustom?.bgPanelSolid,
|
||||
DEFAULT_CUSTOM_TOKENS.bgPanelSolid,
|
||||
),
|
||||
bgElevated: normalizeStoredHex(
|
||||
rawCustom?.bgElevated,
|
||||
DEFAULT_CUSTOM_TOKENS.bgElevated,
|
||||
),
|
||||
border: normalizeStoredHex(rawCustom?.border, DEFAULT_CUSTOM_TOKENS.border),
|
||||
text: normalizeStoredHex(rawCustom?.text, DEFAULT_CUSTOM_TOKENS.text),
|
||||
textDim: normalizeStoredHex(
|
||||
rawCustom?.textDim,
|
||||
DEFAULT_CUSTOM_TOKENS.textDim,
|
||||
),
|
||||
accent: normalizeStoredHex(rawCustom?.accent, DEFAULT_CUSTOM_TOKENS.accent),
|
||||
glow: normalizeStoredHex(rawCustom?.glow, DEFAULT_CUSTOM_TOKENS.glow),
|
||||
green: normalizeStoredHex(rawCustom?.green, DEFAULT_CUSTOM_TOKENS.green),
|
||||
amber: normalizeStoredHex(rawCustom?.amber, DEFAULT_CUSTOM_TOKENS.amber),
|
||||
red: normalizeStoredHex(rawCustom?.red, DEFAULT_CUSTOM_TOKENS.red),
|
||||
violet: normalizeStoredHex(rawCustom?.violet, DEFAULT_CUSTOM_TOKENS.violet),
|
||||
panelOpacity: Number.isFinite(opacityNum)
|
||||
? Math.max(0.65, Math.min(1, opacityNum))
|
||||
: DEFAULT_CUSTOM_TOKENS.panelOpacity,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const TOKEN_KEY = "spacegaem_proto_token";
|
||||
|
|
@ -36,39 +235,35 @@ export function setToken(t: string | null): void {
|
|||
else localStorage.removeItem(TOKEN_KEY);
|
||||
}
|
||||
|
||||
let cachedSettings: ClientSettings | null = null;
|
||||
|
||||
export function getSettings(): ClientSettings {
|
||||
if (cachedSettings) return cachedSettings;
|
||||
try {
|
||||
const raw = JSON.parse(
|
||||
localStorage.getItem(SETTINGS_KEY) ?? "{}",
|
||||
) as Partial<ClientSettings>;
|
||||
return {
|
||||
quality: raw.quality ?? "high",
|
||||
) as LegacyClientSettings;
|
||||
cachedSettings = {
|
||||
quality:
|
||||
raw.quality === "low" || raw.quality === "medium" ? raw.quality : "high",
|
||||
sound: raw.sound ?? true,
|
||||
notifications: raw.notifications ?? true,
|
||||
dynamicTheme: raw.dynamicTheme ?? true,
|
||||
colorMode: raw.colorMode === "light" ? "light" : "dark",
|
||||
reducedEffects: raw.reducedEffects ?? false,
|
||||
theme: normalizeThemeConfig(raw.theme, raw),
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
cachedSettings = {
|
||||
quality: "high",
|
||||
sound: true,
|
||||
notifications: true,
|
||||
dynamicTheme: true,
|
||||
colorMode: "dark",
|
||||
reducedEffects: false,
|
||||
theme: normalizeThemeConfig(null),
|
||||
};
|
||||
}
|
||||
return cachedSettings;
|
||||
}
|
||||
|
||||
export function saveSettings(s: ClientSettings): void {
|
||||
localStorage.setItem(SETTINGS_KEY, JSON.stringify(s));
|
||||
document.body.dataset.dynamicTheme = s.dynamicTheme ? "on" : "off";
|
||||
document.documentElement.dataset.colorMode = s.colorMode;
|
||||
document.documentElement.classList.toggle(
|
||||
"reduced-effects",
|
||||
!!s.reducedEffects,
|
||||
);
|
||||
cachedSettings = s;
|
||||
}
|
||||
|
||||
async function request<T = any>(
|
||||
|
|
|
|||
|
|
@ -15,15 +15,8 @@ import {
|
|||
state,
|
||||
type WikiScreenParams,
|
||||
} from "./state.js";
|
||||
import { applyVisualPreferences } from "./theme.js";
|
||||
import {
|
||||
getColorMode,
|
||||
isReducedEffects,
|
||||
toggleColorMode,
|
||||
toggleReducedEffects,
|
||||
} from "./theme.js";
|
||||
import {
|
||||
clear,
|
||||
h,
|
||||
initNotificationDrawer,
|
||||
initTooltipController,
|
||||
toast,
|
||||
|
|
@ -57,46 +50,6 @@ registerScreenRenderers({
|
|||
wiki: (el, p) => renderWiki(el, p as WikiScreenParams),
|
||||
});
|
||||
|
||||
function renderComfortToolbar(): void {
|
||||
const root = document.getElementById("comfort-controls-root");
|
||||
if (!root) return;
|
||||
clear(root);
|
||||
const mode = getColorMode();
|
||||
const reduced = isReducedEffects();
|
||||
root.appendChild(
|
||||
h(
|
||||
"div",
|
||||
{ class: "comfort-pill-bar" },
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
class: `comfort-btn ${mode === "light" ? "active" : ""}`,
|
||||
title: "Toggle Daylight Light Mode / Dark Mode",
|
||||
onClick: () => {
|
||||
toggleColorMode();
|
||||
renderComfortToolbar();
|
||||
},
|
||||
},
|
||||
mode === "light" ? "SUN LIGHT" : "DARK",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
class: `comfort-btn ${reduced ? "active" : ""}`,
|
||||
title:
|
||||
"Toggle Eye-Saver (Reduced Effects: disables glows, scanlines & shake)",
|
||||
onClick: () => {
|
||||
toggleReducedEffects();
|
||||
applyThemeFromState();
|
||||
renderComfortToolbar();
|
||||
},
|
||||
},
|
||||
reduced ? "EYE-SAVER ON" : "EYE-SAVER",
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
async function waitForStylesAndLoad(): Promise<void> {
|
||||
const pendingLinks = Array.from(
|
||||
document.querySelectorAll('link[rel="stylesheet"]'),
|
||||
|
|
@ -125,8 +78,7 @@ async function waitForStylesAndLoad(): Promise<void> {
|
|||
async function boot(): Promise<void> {
|
||||
saveSettings(getSettings());
|
||||
applyThemeFromState();
|
||||
renderComfortToolbar();
|
||||
window.addEventListener("sgywftp:theme-changed", renderComfortToolbar);
|
||||
applyVisualPreferences();
|
||||
initNotificationDrawer();
|
||||
initTooltipController();
|
||||
initWalkthroughController();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import * as THREE from "three";
|
|||
import { navigate } from "../router.js";
|
||||
import { refreshMe, refreshWorld } from "../session.js";
|
||||
import { currentContract, state } from "../state.js";
|
||||
import { getThemePalette } from "../theme.js";
|
||||
import { encodeModelPath, loadFittedModel } from "../three/modelLoader.js";
|
||||
import { buildLaunchComplex, buildRocketMesh } from "../three/rocketMesh.js";
|
||||
import { createView } from "../three/sceneManager.js";
|
||||
|
|
@ -12,7 +13,7 @@ import {
|
|||
isPartUnlocked,
|
||||
validateDesign,
|
||||
} from "../../shared/physics.js";
|
||||
import { h } from "../ui.js";
|
||||
import { h, openThemeSettingsModal } from "../ui.js";
|
||||
import {
|
||||
createFlightsPanel,
|
||||
createHazardPanel,
|
||||
|
|
@ -43,18 +44,24 @@ export function renderDashboard(root: HTMLElement): () => void {
|
|||
const sidebarEl = h("div", { class: "dash-sidebar" });
|
||||
const view = createView(viewportEl, { fov: 44, far: 15000 });
|
||||
view.addStars(2600, 5000);
|
||||
view.scene.fog = new THREE.FogExp2(0x0b0e14, 0.0028);
|
||||
const apron = new THREE.Mesh(
|
||||
new THREE.CircleGeometry(140, 48),
|
||||
new THREE.MeshStandardMaterial({
|
||||
const apronMat = new THREE.MeshStandardMaterial({
|
||||
color: 0x151b26,
|
||||
roughness: 0.9,
|
||||
metalness: 0.1,
|
||||
}),
|
||||
);
|
||||
});
|
||||
const apron = new THREE.Mesh(new THREE.CircleGeometry(140, 48), apronMat);
|
||||
apron.rotation.x = -Math.PI / 2;
|
||||
apron.position.y = -0.15;
|
||||
view.scene.add(apron);
|
||||
const syncDashboardAtmosphere = () => {
|
||||
const pal = getThemePalette();
|
||||
view.scene.fog = pal.isGradient
|
||||
? null
|
||||
: new THREE.FogExp2(pal.sceneBgWithStars, 0.0028);
|
||||
apronMat.color.set(pal.isLight ? 0x64748b : 0x151b26);
|
||||
};
|
||||
syncDashboardAtmosphere();
|
||||
window.addEventListener("sgywftp:theme-changed", syncDashboardAtmosphere);
|
||||
let padSubject: THREE.Group | null = null;
|
||||
let disposed = false;
|
||||
async function populatePad() {
|
||||
|
|
@ -173,6 +180,14 @@ export function renderDashboard(root: HTMLElement): () => void {
|
|||
},
|
||||
"Wiki & Tutorial",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
class: "btn xs",
|
||||
onClick: () => openThemeSettingsModal(),
|
||||
},
|
||||
"Theme Settings",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{ class: "btn xs ghost", onClick: () => navigate("mainMenu") },
|
||||
|
|
@ -358,6 +373,10 @@ export function renderDashboard(root: HTMLElement): () => void {
|
|||
return () => {
|
||||
disposed = true;
|
||||
window.clearInterval(poll);
|
||||
window.removeEventListener(
|
||||
"sgywftp:theme-changed",
|
||||
syncDashboardAtmosphere,
|
||||
);
|
||||
view.dispose();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,20 @@
|
|||
// Effects so it looks cool and people ignore how broken things probably are
|
||||
import * as THREE from "three";
|
||||
import { setPlumeAtmosphere } from "../../three/rocketMesh.js";
|
||||
import { getColorMode, isReducedEffects } from "../../theme.js";
|
||||
import {
|
||||
getThemePalette,
|
||||
isReducedMotionEffects,
|
||||
type ResolvedThemePalette,
|
||||
} from "../../theme.js";
|
||||
import type { TelemetrySample } from "../../../shared/types.js";
|
||||
import type { LaunchContext } from "./context.js";
|
||||
import { advanceGpuPool, spawnExhaustParticle } from "./particles.js";
|
||||
|
||||
const skyLow = new THREE.Color(0x0c1a33);
|
||||
const skyMid = new THREE.Color(0x091020);
|
||||
const skySpace = new THREE.Color(0x0b0e14);
|
||||
let lastPalette: ResolvedThemePalette | null = null;
|
||||
const daySkyLowColor = new THREE.Color(0x0c1a33);
|
||||
const spaceColor = new THREE.Color(0x0b0e14);
|
||||
const tmpColor = new THREE.Color();
|
||||
const nozzleWorldPos = new THREE.Vector3();
|
||||
const exhaustDir = new THREE.Vector3();
|
||||
|
|
@ -38,8 +44,9 @@ export function updateAscentVisuals(
|
|||
const prevPos = ctx.rocketRoot.position.clone();
|
||||
ctx.rocketRoot.position.set(visDr, visAlt + ctx.cgPivotY, 0);
|
||||
ctx.rocketRoot.rotation.z = -((90 - sample.pitchDeg) * Math.PI) / 180;
|
||||
const reducedMotion = isReducedMotionEffects();
|
||||
const aoaBuffet =
|
||||
!isReducedEffects() &&
|
||||
!reducedMotion &&
|
||||
sample.dynamicPressure > 15000 &&
|
||||
Math.abs(sample.aoaDeg ?? 0) > 6
|
||||
? Math.sin(now * 0.045) * 0.025
|
||||
|
|
@ -78,7 +85,7 @@ export function updateAscentVisuals(
|
|||
const qShake = Math.max(0, sample.dynamicPressure / 65000 - 0.12) * 0.48;
|
||||
const gShake = Math.max(0, sample.gLoad - 2.2) * 0.09;
|
||||
const shakeAmp =
|
||||
ctx.paused || isReducedEffects()
|
||||
ctx.paused || reducedMotion
|
||||
? 0
|
||||
: Math.min(0.65, qShake + gShake + (sample.thrusting ? 0.04 : 0));
|
||||
if (shakeAmp > 0.01) {
|
||||
|
|
@ -89,12 +96,17 @@ export function updateAscentVisuals(
|
|||
);
|
||||
ctx.view.camera.position.add(ctx.prevShake);
|
||||
}
|
||||
const daySkyLow =
|
||||
getColorMode() === "light" ? new THREE.Color(0xcbdcf0) : skyLow;
|
||||
const pal = getThemePalette();
|
||||
if (pal !== lastPalette) {
|
||||
lastPalette = pal;
|
||||
daySkyLowColor.set(pal.isLight ? pal.daySkyLow : "#0c1a33");
|
||||
spaceColor.set(pal.isGradient ? "#0b0e14" : pal.sceneBgWithStars);
|
||||
}
|
||||
const daySkyLow = pal.isLight ? daySkyLowColor : skyLow;
|
||||
if (altKm < 25) {
|
||||
tmpColor.lerpColors(daySkyLow, skyMid, Math.min(1, altKm / 25));
|
||||
} else {
|
||||
tmpColor.lerpColors(skyMid, skySpace, Math.min(1, (altKm - 25) / 55));
|
||||
tmpColor.lerpColors(skyMid, spaceColor, Math.min(1, (altKm - 25) / 55));
|
||||
}
|
||||
ctx.view.scene.background = tmpColor;
|
||||
if (ctx.rocketHandle && sample.stage > ctx.highestStageShown) {
|
||||
|
|
@ -230,8 +242,8 @@ export function updateAscentVisuals(
|
|||
burning && (preIgnition ? idx === 0 : idx === activeIdx);
|
||||
plume.visible = shouldShow;
|
||||
if (shouldShow) {
|
||||
const effJitter = isReducedEffects() ? 1.0 : jitter;
|
||||
const yJit = isReducedEffects() ? 1.0 : 0.92 + Math.random() * 0.18;
|
||||
const effJitter = reducedMotion ? 1.0 : jitter;
|
||||
const yJit = reducedMotion ? 1.0 : 0.92 + Math.random() * 0.18;
|
||||
plume.scale.set(
|
||||
throttleScale * effJitter * vacExpand,
|
||||
throttleScale * yJit * (1 + Math.min(1.05, altKm / 55)),
|
||||
|
|
@ -249,7 +261,7 @@ export function updateAscentVisuals(
|
|||
.set(0, -1, 0)
|
||||
.applyEuler(ctx.rocketRoot.rotation)
|
||||
.normalize();
|
||||
const red = isReducedEffects();
|
||||
const red = reducedMotion;
|
||||
const spawns = (altM < 250 ? 5 : altKm < 38 ? 3 : 2) * (red ? 0.5 : 1);
|
||||
const spawnCount = Math.max(1, Math.round(spawns));
|
||||
for (let s = 0; s < spawnCount; s++) {
|
||||
|
|
@ -366,7 +378,7 @@ export function updateAscentVisuals(
|
|||
if (showMach) {
|
||||
const strength = Math.max(0, 1 - Math.abs(mach - 1.03) / 0.24);
|
||||
ctx.machConeMat.uniforms.uOpacity.value =
|
||||
strength * (isReducedEffects() ? 0.36 : 0.42 + Math.random() * 0.14);
|
||||
strength * (reducedMotion ? 0.36 : 0.42 + Math.random() * 0.14);
|
||||
const s = 0.9 + strength * 0.35;
|
||||
ctx.machCone.scale.set(s, s, s);
|
||||
}
|
||||
|
|
@ -375,7 +387,7 @@ export function updateAscentVisuals(
|
|||
const showPlasma = sample.heatFluxWcm2 > 5;
|
||||
ctx.plasmaGlow.visible = showPlasma;
|
||||
if (showPlasma) {
|
||||
const jit = isReducedEffects() ? 1.0 : 0.88 + Math.random() * 0.2;
|
||||
const jit = reducedMotion ? 1.0 : 0.88 + Math.random() * 0.2;
|
||||
ctx.plasmaGlowMat.uniforms.uOpacity.value = Math.min(
|
||||
0.68,
|
||||
((sample.heatFluxWcm2 - 5) / 36) * jit,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Ascent sky, curved Earth horizon, clouds, and supersonic aero shock shaders
|
||||
import * as THREE from "three";
|
||||
import { getSettings } from "../../api.js";
|
||||
import { isReducedEffects } from "../../theme.js";
|
||||
import { isReducedMotionEffects } from "../../theme.js";
|
||||
import type { RocketMeshHandle } from "../../three/rocketMesh.js";
|
||||
import { getSoftParticleTexture } from "../../three/sceneManager.js";
|
||||
import { createGpuParticlePool, type GpuParticlePool } from "./particles.js";
|
||||
|
|
@ -155,7 +155,7 @@ export function createAscentEnvironment(): {
|
|||
env.add(m);
|
||||
}
|
||||
const q = getSettings().quality;
|
||||
const red = isReducedEffects();
|
||||
const red = isReducedMotionEffects();
|
||||
const smokeCount = Math.round(
|
||||
(q === "low" ? 300 : q === "medium" ? 700 : 1200) * (red ? 0.5 : 1),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Cool lookin stuff
|
||||
import { navigate } from "../../router.js";
|
||||
import { state } from "../../state.js";
|
||||
import { getColorMode } from "../../theme.js";
|
||||
import { getThemePalette } from "../../theme.js";
|
||||
import { getUnlockedDiagnosticTier } from "../../../shared/physics.js";
|
||||
import type { TelemetrySample } from "../../../shared/types.js";
|
||||
import { clear, fmtNum, h, term } from "../../ui.js";
|
||||
|
|
@ -215,7 +215,7 @@ export function updateTelemetryHud(
|
|||
if (c2d) {
|
||||
const W = ctx.liveStripCanvas.width;
|
||||
const H = ctx.liveStripCanvas.height;
|
||||
c2d.fillStyle = getColorMode() === "light" ? "#f1f5f9" : "#090d14";
|
||||
c2d.fillStyle = getThemePalette().bgDeep;
|
||||
c2d.fillRect(0, 0, W, H);
|
||||
const drawLine = (
|
||||
col: string,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Spin
|
||||
import * as THREE from "three";
|
||||
import { applyThemeFromState, currentContract } from "../../state.js";
|
||||
import { getThemePalette } from "../../theme.js";
|
||||
import { BODY_RADIUS_KM } from "../../../shared/ephemeris.js";
|
||||
import type { SimResult, TelemetrySample } from "../../../shared/types.js";
|
||||
import type { LaunchContext } from "./context.js";
|
||||
|
|
@ -85,7 +86,10 @@ export function enterOrbitPhase(ctx: LaunchContext): void {
|
|||
ctx.debrisList.length = 0;
|
||||
ctx.jettisonedDropStages.clear();
|
||||
ctx.hudVals = null;
|
||||
ctx.view.scene.background = new THREE.Color(0x0b0e14);
|
||||
const pal = getThemePalette();
|
||||
ctx.view.scene.background = pal.isGradient
|
||||
? null
|
||||
: new THREE.Color(pal.sceneBgWithStars);
|
||||
ctx.orbitGroup = new THREE.Group();
|
||||
const target =
|
||||
ctx.trajectory?.target ??
|
||||
|
|
|
|||
|
|
@ -11,83 +11,97 @@ import {
|
|||
import { navigate } from "../router.js";
|
||||
import { refreshMe, refreshWorld, startEvents } from "../session.js";
|
||||
import { state } from "../state.js";
|
||||
import {
|
||||
COLOR_SET_OPTIONS,
|
||||
getThemeConfig,
|
||||
SHAPE_SET_OPTIONS,
|
||||
} from "../theme.js";
|
||||
import { createView } from "../three/sceneManager.js";
|
||||
import { buildSolarSystem } from "../three/solarSystem.js";
|
||||
import { h, modal, toast } from "../ui.js";
|
||||
import { h, modal, openThemeSettingsModal, toast } from "../ui.js";
|
||||
|
||||
function openSettingsModal(): void {
|
||||
const s = { ...getSettings() };
|
||||
const initial = getSettings();
|
||||
let quality = initial.quality;
|
||||
let sound = initial.sound;
|
||||
let notifications = initial.notifications;
|
||||
const qualitySel = h(
|
||||
"select",
|
||||
{
|
||||
class: "input",
|
||||
onChange: () => {
|
||||
s.quality = qualitySel.value as typeof s.quality;
|
||||
quality = qualitySel.value as typeof quality;
|
||||
},
|
||||
},
|
||||
h(
|
||||
"option",
|
||||
{ value: "low", selected: s.quality === "low" },
|
||||
{ value: "low", selected: quality === "low" },
|
||||
"Low (1x DPR, low shadow/antialias)",
|
||||
),
|
||||
h(
|
||||
"option",
|
||||
{ value: "medium", selected: s.quality === "medium" },
|
||||
{ value: "medium", selected: quality === "medium" },
|
||||
"Medium (1.5x DPR)",
|
||||
),
|
||||
h(
|
||||
"option",
|
||||
{ value: "high", selected: s.quality === "high" },
|
||||
{ value: "high", selected: quality === "high" },
|
||||
"High (Native DPR + antialias)",
|
||||
),
|
||||
);
|
||||
const colorModeSel = h(
|
||||
"select",
|
||||
{
|
||||
class: "input",
|
||||
onChange: () => {
|
||||
s.colorMode = colorModeSel.value as "dark" | "light";
|
||||
},
|
||||
},
|
||||
h(
|
||||
"option",
|
||||
{ value: "dark", selected: s.colorMode === "dark" },
|
||||
"Dark Slate (Default Night Ops)",
|
||||
),
|
||||
h(
|
||||
"option",
|
||||
{ value: "light", selected: s.colorMode === "light" },
|
||||
"Daylight Clean (Light Mode)",
|
||||
),
|
||||
);
|
||||
const reducedChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: s.reducedEffects,
|
||||
onChange: () => {
|
||||
s.reducedEffects = reducedChk.checked;
|
||||
},
|
||||
});
|
||||
const soundChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: s.sound,
|
||||
checked: sound,
|
||||
onChange: () => {
|
||||
s.sound = soundChk.checked;
|
||||
sound = soundChk.checked;
|
||||
},
|
||||
});
|
||||
const notifChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: s.notifications,
|
||||
checked: notifications,
|
||||
onChange: () => {
|
||||
s.notifications = notifChk.checked;
|
||||
notifications = notifChk.checked;
|
||||
},
|
||||
});
|
||||
const dynChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: s.dynamicTheme,
|
||||
onChange: () => {
|
||||
s.dynamicTheme = dynChk.checked;
|
||||
const themeSummaryBadge = h("span", { class: "badge info" }, "");
|
||||
const syncThemeBadge = () => {
|
||||
const t = getThemeConfig();
|
||||
const shapeLabel =
|
||||
SHAPE_SET_OPTIONS.find((o) => o.id === t.shapeSet)?.label ?? t.shapeSet;
|
||||
const colorLabel =
|
||||
COLOR_SET_OPTIONS.find((o) => o.id === t.colorSet)?.label ?? t.colorSet;
|
||||
themeSummaryBadge.textContent = `${shapeLabel} · ${colorLabel}`;
|
||||
};
|
||||
syncThemeBadge();
|
||||
window.addEventListener("sgywftp:theme-changed", syncThemeBadge);
|
||||
const themeRow = h(
|
||||
"div",
|
||||
{ class: "slot-group" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "spread" },
|
||||
h("span", { class: "slot-title" }, "Theme & Appearance"),
|
||||
themeSummaryBadge,
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "spread" },
|
||||
h(
|
||||
"span",
|
||||
{ class: "dim", style: { fontSize: "11px" } },
|
||||
"Shape-set, color presets, gradients, custom palette & comfort effects",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn sm",
|
||||
onClick: () => openThemeSettingsModal(),
|
||||
},
|
||||
});
|
||||
"Theme Settings",
|
||||
),
|
||||
),
|
||||
);
|
||||
const mlRow = h(
|
||||
"div",
|
||||
{ class: "slot-group", style: { marginTop: "6px" } },
|
||||
|
|
@ -153,17 +167,7 @@ function openSettingsModal(): void {
|
|||
"div",
|
||||
{ class: "col" },
|
||||
h("label", { class: "field" }, "3D Graphics Quality", qualitySel),
|
||||
h("label", { class: "field" }, "Color Theme", colorModeSel),
|
||||
h(
|
||||
"label",
|
||||
{ class: "row", style: { cursor: "pointer" } },
|
||||
reducedChk,
|
||||
h(
|
||||
"span",
|
||||
{},
|
||||
"Reduced Effects / Eye-Saver (disables glows, blur, chamfers, scanlines & camera shake)",
|
||||
),
|
||||
),
|
||||
themeRow,
|
||||
h(
|
||||
"label",
|
||||
{ class: "row", style: { cursor: "pointer" } },
|
||||
|
|
@ -176,26 +180,24 @@ function openSettingsModal(): void {
|
|||
notifChk,
|
||||
h("span", {}, "Mission & Space Weather Notifications"),
|
||||
),
|
||||
h(
|
||||
"label",
|
||||
{ class: "row", style: { cursor: "pointer" } },
|
||||
dynChk,
|
||||
h(
|
||||
"span",
|
||||
{},
|
||||
"Dynamic Simulation Color Palette (shifts with space weather & target)",
|
||||
),
|
||||
),
|
||||
mlRow,
|
||||
);
|
||||
const cleanupBadge = () =>
|
||||
window.removeEventListener("sgywftp:theme-changed", syncThemeBadge);
|
||||
modal("System & Graphics Settings", body, [
|
||||
{ label: "Cancel", kind: "ghost" },
|
||||
{ label: "Cancel", kind: "ghost", onClick: cleanupBadge },
|
||||
{
|
||||
label: "Save Settings",
|
||||
kind: "primary",
|
||||
onClick: () => {
|
||||
saveSettings(s);
|
||||
window.dispatchEvent(new CustomEvent("sgywftp:theme-changed"));
|
||||
cleanupBadge();
|
||||
const latest = getSettings();
|
||||
saveSettings({
|
||||
...latest,
|
||||
quality,
|
||||
sound,
|
||||
notifications,
|
||||
});
|
||||
toast("Settings saved.", "ok");
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ import {
|
|||
type MissionConfigContext,
|
||||
} from "./missionConfig/prelaunch.js";
|
||||
|
||||
export function renderMissionConfig(root: HTMLElement): void {
|
||||
export function renderMissionConfig(root: HTMLElement): () => void {
|
||||
const agency = state.agency;
|
||||
if (!agency) {
|
||||
navigate("auth");
|
||||
return;
|
||||
return () => {};
|
||||
}
|
||||
const contract = currentContract();
|
||||
const workingDesign = normalizeDesign(
|
||||
|
|
@ -377,5 +377,10 @@ export function renderMissionConfig(root: HTMLElement): void {
|
|||
),
|
||||
);
|
||||
recomputePreview();
|
||||
const onThemeChanged = () => renderDiagPanel(ctx);
|
||||
window.addEventListener("sgywftp:theme-changed", onThemeChanged);
|
||||
root.appendChild(h("div", { class: "screen param-root" }, mainCol, sideCol));
|
||||
return () => {
|
||||
window.removeEventListener("sgywftp:theme-changed", onThemeChanged);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import type {
|
|||
SimResult,
|
||||
TrajectoryResult,
|
||||
} from "../../../shared/types.js";
|
||||
import { getColorMode } from "../../theme.js";
|
||||
import { getThemePalette } from "../../theme.js";
|
||||
import { clear, fmtDuration, fmtNum, h } from "../../ui.js";
|
||||
|
||||
export function drawAscentChart(
|
||||
|
|
@ -17,12 +17,14 @@ export function drawAscentChart(
|
|||
): void {
|
||||
const ctx = ascentCanvas.getContext("2d");
|
||||
if (!ctx) return;
|
||||
const light = getColorMode() === "light";
|
||||
const pal = getThemePalette();
|
||||
const W = ascentCanvas.width;
|
||||
const H = ascentCanvas.height;
|
||||
ctx.fillStyle = light ? "#f8fafc" : "#0b0e14";
|
||||
ctx.fillStyle = pal.bgDeep;
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
ctx.strokeStyle = light ? "rgba(15, 23, 42, 0.12)" : "rgba(42, 52, 73, 0.55)";
|
||||
ctx.save();
|
||||
ctx.strokeStyle = pal.border;
|
||||
ctx.globalAlpha = 0.55;
|
||||
ctx.lineWidth = 1;
|
||||
for (let i = 1; i < 5; i++) {
|
||||
const y = (H / 5) * i;
|
||||
|
|
@ -31,6 +33,7 @@ export function drawAscentChart(
|
|||
ctx.lineTo(W - 14, y);
|
||||
ctx.stroke();
|
||||
}
|
||||
ctx.restore();
|
||||
const pts = sim.telemetry;
|
||||
if (!pts.length) return;
|
||||
const maxDr = Math.max(250, ...pts.map((p) => p.downrange / 1000));
|
||||
|
|
@ -49,7 +52,7 @@ export function drawAscentChart(
|
|||
);
|
||||
const qx = toX(qPeak.downrange / 1000);
|
||||
const qy = toY(qPeak.altitude / 1000);
|
||||
ctx.strokeStyle = sim.success ? (light ? "#0284c7" : "#60a5fa") : "#ef4444";
|
||||
ctx.strokeStyle = sim.success ? pal.accent : pal.red;
|
||||
ctx.lineWidth = 2.4;
|
||||
ctx.beginPath();
|
||||
pts.forEach((p, idx) => {
|
||||
|
|
@ -59,7 +62,7 @@ export function drawAscentChart(
|
|||
else ctx.lineTo(x, y);
|
||||
});
|
||||
ctx.stroke();
|
||||
ctx.fillStyle = "#f59e0b";
|
||||
ctx.fillStyle = pal.amber;
|
||||
ctx.beginPath();
|
||||
ctx.arc(qx, qy, 4.5, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
|
|
@ -69,11 +72,11 @@ export function drawAscentChart(
|
|||
Math.min(W - 140, qx + 8),
|
||||
Math.max(16, qy - 6),
|
||||
);
|
||||
ctx.fillStyle = light ? "#475569" : "#94a3b8";
|
||||
ctx.fillStyle = pal.textDim;
|
||||
ctx.fillText("0 km", 6, padT + ph);
|
||||
ctx.fillText(`${Math.round(maxAlt)} km`, 4, padT + 10);
|
||||
ctx.fillText(`Downrange ${Math.round(maxDr)} km`, W - 150, H - 6);
|
||||
ctx.fillStyle = sim.success ? (light ? "#059669" : "#34d399") : "#ef4444";
|
||||
ctx.fillStyle = sim.success ? pal.green : pal.red;
|
||||
ctx.fillText(
|
||||
sim.success
|
||||
? `ORBIT INSERTION ${Math.round(sim.periapsis / 1000)}×${Math.round(sim.apoapsis / 1000)} km`
|
||||
|
|
@ -90,12 +93,14 @@ export function drawMultiTelemetryChart(
|
|||
): void {
|
||||
const ctx = telemetryDiagCanvas.getContext("2d");
|
||||
if (!ctx) return;
|
||||
const light = getColorMode() === "light";
|
||||
const pal = getThemePalette();
|
||||
const W = telemetryDiagCanvas.width;
|
||||
const H = telemetryDiagCanvas.height;
|
||||
ctx.fillStyle = light ? "#f8fafc" : "#0b0e14";
|
||||
ctx.fillStyle = pal.bgDeep;
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
ctx.strokeStyle = light ? "rgba(15, 23, 42, 0.12)" : "rgba(42, 52, 73, 0.55)";
|
||||
ctx.save();
|
||||
ctx.strokeStyle = pal.border;
|
||||
ctx.globalAlpha = 0.55;
|
||||
ctx.lineWidth = 1;
|
||||
for (let i = 1; i < 4; i++) {
|
||||
const y = (H / 4) * i;
|
||||
|
|
@ -104,6 +109,7 @@ export function drawMultiTelemetryChart(
|
|||
ctx.lineTo(W - 16, y);
|
||||
ctx.stroke();
|
||||
}
|
||||
ctx.restore();
|
||||
const pts = sim.telemetry;
|
||||
if (!pts.length) return;
|
||||
const maxT = Math.max(10, pts[pts.length - 1].t);
|
||||
|
|
@ -158,7 +164,7 @@ export function drawMultiTelemetryChart(
|
|||
420,
|
||||
16,
|
||||
);
|
||||
ctx.fillStyle = light ? "#475569" : "#94a3b8";
|
||||
ctx.fillStyle = pal.textDim;
|
||||
ctx.fillText(`T+0s`, padL, H - 6);
|
||||
ctx.fillText(`T+${Math.round(maxT)}s`, W - 64, H - 6);
|
||||
const compFault =
|
||||
|
|
@ -239,10 +245,10 @@ export function drawOrbitChart(opts: OrbitChartOptions): void {
|
|||
opts;
|
||||
const ctx = orbitCanvas.getContext("2d");
|
||||
if (!ctx) return;
|
||||
const light = getColorMode() === "light";
|
||||
const pal = getThemePalette();
|
||||
const W = orbitCanvas.width;
|
||||
const H = orbitCanvas.height;
|
||||
ctx.fillStyle = light ? "#f8fafc" : "#0b0e14";
|
||||
ctx.fillStyle = pal.bgDeep;
|
||||
ctx.fillRect(0, 0, W, H);
|
||||
const traj =
|
||||
trajInput ??
|
||||
|
|
@ -272,11 +278,11 @@ export function drawOrbitChart(opts: OrbitChartOptions): void {
|
|||
const x1 = cx + p1.x * scale;
|
||||
const y1 = cy + p1.z * scale;
|
||||
if (p1.inShadow) {
|
||||
ctx.strokeStyle = "#a855f7";
|
||||
ctx.strokeStyle = pal.violet;
|
||||
} else if ((p1.radBeltFlux ?? 0) > 1.0) {
|
||||
ctx.strokeStyle = "#f59e0b";
|
||||
ctx.strokeStyle = pal.amber;
|
||||
} else {
|
||||
ctx.strokeStyle = light ? "#0284c7" : "#60a5fa";
|
||||
ctx.strokeStyle = pal.accent;
|
||||
}
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(x0, y0);
|
||||
|
|
@ -293,18 +299,18 @@ export function drawOrbitChart(opts: OrbitChartOptions): void {
|
|||
...traj.points.map((p) => p.perturbationDriftKm ?? 0),
|
||||
);
|
||||
const samplePt = traj.points[Math.floor(traj.points.length * 0.25)];
|
||||
ctx.fillStyle = light ? "#475569" : "#94a3b8";
|
||||
ctx.fillStyle = pal.textDim;
|
||||
ctx.font = "11px monospace";
|
||||
ctx.fillText(
|
||||
`[${traj.source.toUpperCase()}] Target ${(contract?.target ?? "leo").toUpperCase()} • Inc ${fp.targetInclinationDeg.toFixed(1)}° • Period ${fmtDuration(traj.period)}`,
|
||||
14,
|
||||
18,
|
||||
);
|
||||
ctx.fillStyle = "#a855f7";
|
||||
ctx.fillStyle = pal.violet;
|
||||
ctx.fillText(`Eclipse Shadow: ${eclipsePct}%`, 14, H - 10);
|
||||
ctx.fillStyle = "#f59e0b";
|
||||
ctx.fillStyle = pal.amber;
|
||||
ctx.fillText(`Peak Van Allen Flux: ${peakFlux.toFixed(2)}`, 190, H - 10);
|
||||
ctx.fillStyle = "#34d399";
|
||||
ctx.fillStyle = pal.green;
|
||||
ctx.fillText(`Perturbation Drift: ${maxDrift.toFixed(1)} km`, 420, H - 10);
|
||||
clear(gmatStatsBoxEl);
|
||||
gmatStatsBoxEl.append(
|
||||
|
|
|
|||
|
|
@ -1,55 +1,564 @@
|
|||
// The saviour you needed for your eyes, cus mine were burning before making this shit
|
||||
import { getSettings, saveSettings } from "./api.js";
|
||||
// Modular theme engine: Shape-Sets, Color-Sets (presets, gradients, custom tokens),
|
||||
// independent UI/3D comfort toggles, and live 2D/3D palette resolution.
|
||||
import {
|
||||
type ColorSet,
|
||||
type CustomThemeTokens,
|
||||
DEFAULT_THEME_CONFIG,
|
||||
type GradientThemeConfig,
|
||||
getSettings,
|
||||
saveSettings,
|
||||
type ShapeSet,
|
||||
type ThemeConfig,
|
||||
} from "./api.js";
|
||||
import type { SpaceWeather } from "../shared/types.js";
|
||||
|
||||
export function getColorMode(): "dark" | "light" {
|
||||
return getSettings().colorMode === "light" ? "light" : "dark";
|
||||
export type {
|
||||
ColorSet,
|
||||
CustomThemeTokens,
|
||||
GradientThemeConfig,
|
||||
ShapeSet,
|
||||
ThemeConfig,
|
||||
};
|
||||
|
||||
export interface PresetDescriptor<T extends string> {
|
||||
id: T;
|
||||
label: string;
|
||||
tagline: string;
|
||||
}
|
||||
|
||||
export function isReducedEffects(): boolean {
|
||||
return !!getSettings().reducedEffects;
|
||||
export const SHAPE_SET_OPTIONS: PresetDescriptor<ShapeSet>[] = [
|
||||
{
|
||||
id: "chamfered",
|
||||
label: "Chamfered",
|
||||
tagline: "Angled telemetry corner cuts (Default)",
|
||||
},
|
||||
{
|
||||
id: "smooth",
|
||||
label: "Smooth",
|
||||
tagline: "Soft rounded corners (Eye-Saver style)",
|
||||
},
|
||||
{
|
||||
id: "sharp",
|
||||
label: "Sharp / Square",
|
||||
tagline: "Crisp 90° edges, zero corner radius",
|
||||
},
|
||||
];
|
||||
|
||||
export interface ColorSetPreset extends PresetDescriptor<ColorSet> {
|
||||
swatches: [string, string, string, string];
|
||||
tokens?: CustomThemeTokens;
|
||||
}
|
||||
|
||||
export function applyVisualPreferences(): void {
|
||||
const s = getSettings();
|
||||
document.documentElement.dataset.colorMode = s.colorMode;
|
||||
document.documentElement.classList.toggle(
|
||||
"reduced-effects",
|
||||
!!s.reducedEffects,
|
||||
export const COLOR_SET_OPTIONS: ColorSetPreset[] = [
|
||||
{
|
||||
id: "eyebleed",
|
||||
label: "Eyebleed",
|
||||
tagline: "High-contrast night ops & vivid accents (Classic)",
|
||||
swatches: ["#0b0e14", "#19202e", "#60a5fa", "#e2e8f0"],
|
||||
tokens: {
|
||||
bgDeep: "#0b0e14",
|
||||
bgPanelSolid: "#12161f",
|
||||
bgElevated: "#19202e",
|
||||
border: "#2a3449",
|
||||
text: "#e2e8f0",
|
||||
textDim: "#94a3b8",
|
||||
accent: "#60a5fa",
|
||||
glow: "#60a5fa",
|
||||
green: "#34d399",
|
||||
amber: "#f59e0b",
|
||||
red: "#f87171",
|
||||
violet: "#a78bfa",
|
||||
panelOpacity: 0.92,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "subtle",
|
||||
label: "Subtle",
|
||||
tagline: "Muted slate & softened accents (Eye-Saver)",
|
||||
swatches: ["#10141c", "#1e2531", "#648bb8", "#d5dde8"],
|
||||
tokens: {
|
||||
bgDeep: "#10141c",
|
||||
bgPanelSolid: "#161b24",
|
||||
bgElevated: "#1e2531",
|
||||
border: "#2b3444",
|
||||
text: "#d5dde8",
|
||||
textDim: "#8b9ab0",
|
||||
accent: "#648bb8",
|
||||
glow: "#648bb8",
|
||||
green: "#47a885",
|
||||
amber: "#c98e3b",
|
||||
red: "#c96b6b",
|
||||
violet: "#8b7cc8",
|
||||
panelOpacity: 0.96,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "low-contrast",
|
||||
label: "Low Contrast",
|
||||
tagline: "Gentle luminance spread for long sessions",
|
||||
swatches: ["#191d26", "#272d3a", "#6d90ba", "#b3becf"],
|
||||
tokens: {
|
||||
bgDeep: "#191d26",
|
||||
bgPanelSolid: "#202530",
|
||||
bgElevated: "#272d3a",
|
||||
border: "#343c4d",
|
||||
text: "#b3becf",
|
||||
textDim: "#838fa3",
|
||||
accent: "#6d90ba",
|
||||
glow: "#6d90ba",
|
||||
green: "#5fa88d",
|
||||
amber: "#c2944c",
|
||||
red: "#c47678",
|
||||
violet: "#9182c4",
|
||||
panelOpacity: 0.96,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "catppuccin-mocha",
|
||||
label: "Catppuccin Mocha",
|
||||
tagline: "Warm pastel dark palette on deep espresso (Default)",
|
||||
swatches: ["#1e1e2e", "#313244", "#89b4fa", "#cdd6f4"],
|
||||
tokens: {
|
||||
bgDeep: "#1e1e2e",
|
||||
bgPanelSolid: "#181825",
|
||||
bgElevated: "#313244",
|
||||
border: "#45475a",
|
||||
text: "#cdd6f4",
|
||||
textDim: "#a6adc8",
|
||||
accent: "#89b4fa",
|
||||
glow: "#74c7ec",
|
||||
green: "#a6e3a1",
|
||||
amber: "#f9e2af",
|
||||
red: "#f38ba8",
|
||||
violet: "#cba6f7",
|
||||
panelOpacity: 0.94,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "daylight",
|
||||
label: "Daylight Light",
|
||||
tagline: "Clean bright mode for high-ambient rooms",
|
||||
swatches: ["#f1f5f9", "#e2e8f0", "#0284c7", "#0f172a"],
|
||||
tokens: {
|
||||
bgDeep: "#f1f5f9",
|
||||
bgPanelSolid: "#ffffff",
|
||||
bgElevated: "#e2e8f0",
|
||||
border: "#cbd5e1",
|
||||
text: "#0f172a",
|
||||
textDim: "#475569",
|
||||
accent: "#0284c7",
|
||||
glow: "#0284c7",
|
||||
green: "#059669",
|
||||
amber: "#d97706",
|
||||
red: "#dc2626",
|
||||
violet: "#7c3aed",
|
||||
panelOpacity: 0.96,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "gradient",
|
||||
label: "Customizable Gradients",
|
||||
tagline: "Multi-stop backdrop & panel gradients",
|
||||
swatches: ["#0b1120", "#172554", "#38bdf8", "#e2e8f0"],
|
||||
},
|
||||
{
|
||||
id: "custom",
|
||||
label: "Fully Custom Set",
|
||||
tagline: "Edit every surface, text & semantic token",
|
||||
swatches: ["#12161f", "#34d399", "#f59e0b", "#a78bfa"],
|
||||
},
|
||||
];
|
||||
|
||||
export interface GradientStarter {
|
||||
id: string;
|
||||
label: string;
|
||||
config: GradientThemeConfig;
|
||||
}
|
||||
|
||||
export const GRADIENT_STARTERS: GradientStarter[] = [
|
||||
{
|
||||
id: "nebula",
|
||||
label: "Nebula",
|
||||
config: {
|
||||
stops: ["#0b1120", "#1e1b4b", "#0f172a"],
|
||||
angle: 135,
|
||||
mode: "linear",
|
||||
surfaceBase: "dark",
|
||||
applyToPanels: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "aurora",
|
||||
label: "Aurora",
|
||||
config: {
|
||||
stops: ["#071a1f", "#0f3d3e", "#1b1f3b"],
|
||||
angle: 150,
|
||||
mode: "linear",
|
||||
surfaceBase: "dark",
|
||||
applyToPanels: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "sunset",
|
||||
label: "Sunset",
|
||||
config: {
|
||||
stops: ["#1f1024", "#4c1d3d", "#2c1810"],
|
||||
angle: 125,
|
||||
mode: "linear",
|
||||
surfaceBase: "dark",
|
||||
applyToPanels: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "ocean",
|
||||
label: "Deep Ocean",
|
||||
config: {
|
||||
stops: ["#06131f", "#0c2d48", "#0b192c"],
|
||||
angle: 165,
|
||||
mode: "radial",
|
||||
surfaceBase: "dark",
|
||||
applyToPanels: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "dawn",
|
||||
label: "Solar Dawn",
|
||||
config: {
|
||||
stops: ["#f8fafc", "#e0f2fe", "#fef3c7"],
|
||||
angle: 135,
|
||||
mode: "linear",
|
||||
surfaceBase: "light",
|
||||
applyToPanels: true,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const CUSTOM_CSS_VAR_KEYS = [
|
||||
"--bg-deep",
|
||||
"--bg-panel",
|
||||
"--bg-panel-solid",
|
||||
"--bg-elevated",
|
||||
"--bg-hover",
|
||||
"--border",
|
||||
"--border-bright",
|
||||
"--border-subtle",
|
||||
"--text",
|
||||
"--text-dim",
|
||||
"--text-faint",
|
||||
"--brand-blue",
|
||||
"--brand-strong",
|
||||
"--sim-accent",
|
||||
"--sim-accent-dim",
|
||||
"--sim-glow",
|
||||
"--green",
|
||||
"--amber",
|
||||
"--red",
|
||||
"--violet",
|
||||
"--bg-glass",
|
||||
"--bg-inset",
|
||||
"--bg-header-fade",
|
||||
"--overlay-scrim",
|
||||
"--badge-bg",
|
||||
"--btn-primary-bg",
|
||||
"--btn-primary-hover",
|
||||
"--btn-primary-text",
|
||||
"--btn-warn-bg",
|
||||
"--btn-warn-text",
|
||||
"--btn-danger-bg",
|
||||
"--btn-danger-text",
|
||||
"--btn-ghost-bg",
|
||||
"--title-color",
|
||||
"--bg-gradient",
|
||||
"--panel-gradient",
|
||||
] as const;
|
||||
|
||||
export function normalizeHex(hex: string, fallback = "#0b0e14"): string {
|
||||
const trimmed = hex.trim();
|
||||
if (/^#[0-9a-fA-F]{6}$/.test(trimmed)) return trimmed.toLowerCase();
|
||||
if (/^#[0-9a-fA-F]{3}$/.test(trimmed)) {
|
||||
const [, r, g, b] = trimmed;
|
||||
return `#${r}${r}${g}${g}${b}${b}`.toLowerCase();
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
export function hexToRgb(hex: string): [number, number, number] {
|
||||
const clean = normalizeHex(hex).slice(1);
|
||||
return [
|
||||
parseInt(clean.slice(0, 2), 16),
|
||||
parseInt(clean.slice(2, 4), 16),
|
||||
parseInt(clean.slice(4, 6), 16),
|
||||
];
|
||||
}
|
||||
|
||||
export function rgbToHex(r: number, g: number, b: number): string {
|
||||
const clamp = (n: number) =>
|
||||
Math.max(0, Math.min(255, Math.round(n)))
|
||||
.toString(16)
|
||||
.padStart(2, "0");
|
||||
return `#${clamp(r)}${clamp(g)}${clamp(b)}`;
|
||||
}
|
||||
|
||||
export function hexToRgba(hex: string, alpha: number): string {
|
||||
const [r, g, b] = hexToRgb(hex);
|
||||
const a = Math.max(0, Math.min(1, alpha));
|
||||
return `rgba(${r}, ${g}, ${b}, ${Number(a.toFixed(3))})`;
|
||||
}
|
||||
|
||||
export function mixHex(hexA: string, hexB: string, weightB: number): string {
|
||||
const w = Math.max(0, Math.min(1, weightB));
|
||||
const [r1, g1, b1] = hexToRgb(hexA);
|
||||
const [r2, g2, b2] = hexToRgb(hexB);
|
||||
return rgbToHex(
|
||||
r1 + (r2 - r1) * w,
|
||||
g1 + (g2 - g1) * w,
|
||||
b1 + (b2 - b1) * w,
|
||||
);
|
||||
document.body.dataset.dynamicTheme =
|
||||
s.dynamicTheme && !s.reducedEffects ? "on" : "off";
|
||||
}
|
||||
|
||||
export function isLightHex(hex: string): boolean {
|
||||
const [r, g, b] = hexToRgb(hex).map((v) => {
|
||||
const s = v / 255;
|
||||
return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
||||
});
|
||||
const lum = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||
return lum > 0.42;
|
||||
}
|
||||
|
||||
export function buildCustomTokensFromPreset(
|
||||
presetId: Exclude<ColorSet, "gradient" | "custom">,
|
||||
): CustomThemeTokens {
|
||||
const found = COLOR_SET_OPTIONS.find((p) => p.id === presetId);
|
||||
const tokens = found?.tokens ?? COLOR_SET_OPTIONS[0].tokens!;
|
||||
return { ...tokens };
|
||||
}
|
||||
|
||||
export function formatGradientCss(g: GradientThemeConfig): string {
|
||||
const stops = g.stops.length >= 2 ? g.stops : ["#0b1120", "#172554"];
|
||||
if (g.mode === "radial") {
|
||||
return `radial-gradient(circle at 50% 25%, ${stops.join(", ")})`;
|
||||
}
|
||||
return `linear-gradient(${g.angle}deg, ${stops.join(", ")})`;
|
||||
}
|
||||
|
||||
let previewThemeOverride: ThemeConfig | null = null;
|
||||
|
||||
export function getThemeConfig(): ThemeConfig {
|
||||
return previewThemeOverride ?? getSettings().theme;
|
||||
}
|
||||
|
||||
export function setThemePreview(
|
||||
theme: ThemeConfig | null,
|
||||
dispatchEvent = true,
|
||||
): void {
|
||||
previewThemeOverride = theme ? structuredClone(theme) : null;
|
||||
applyThemeConfig(getThemeConfig(), dispatchEvent);
|
||||
}
|
||||
|
||||
export function saveThemeConfig(theme: ThemeConfig): void {
|
||||
previewThemeOverride = null;
|
||||
const s = getSettings();
|
||||
s.theme = structuredClone(theme);
|
||||
saveSettings(s);
|
||||
applyVisualPreferences();
|
||||
}
|
||||
|
||||
export function isLightSurface(): boolean {
|
||||
const t = getThemeConfig();
|
||||
if (t.colorSet === "daylight") return true;
|
||||
if (t.colorSet === "gradient") return t.gradient.surfaceBase === "light";
|
||||
if (t.colorSet === "custom") return isLightHex(t.custom.bgDeep);
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isReducedMotionEffects(): boolean {
|
||||
return !getThemeConfig().motionEffects;
|
||||
}
|
||||
|
||||
export function getColorMode(): "dark" | "light" {
|
||||
return isLightSurface() ? "light" : "dark";
|
||||
}
|
||||
|
||||
function clearCustomCssVars(): void {
|
||||
const style = document.documentElement.style;
|
||||
for (const key of CUSTOM_CSS_VAR_KEYS) {
|
||||
style.removeProperty(key);
|
||||
}
|
||||
}
|
||||
|
||||
function applyDerivedTokens(
|
||||
tokens: CustomThemeTokens,
|
||||
uiEffects: boolean,
|
||||
extras: { bgGradient?: string; panelGradient?: string } = {},
|
||||
): void {
|
||||
const light = isLightHex(tokens.bgDeep);
|
||||
const style = document.documentElement.style;
|
||||
const set = (k: string, v: string) => style.setProperty(k, v);
|
||||
|
||||
const bgHover = mixHex(tokens.bgElevated, tokens.text, light ? 0.1 : 0.08);
|
||||
const borderBright = mixHex(tokens.border, tokens.text, 0.18);
|
||||
const textFaint = mixHex(tokens.textDim, tokens.bgDeep, 0.35);
|
||||
const brandStrong = mixHex(tokens.accent, light ? "#000000" : "#0b0e14", 0.22);
|
||||
|
||||
set("--bg-deep", tokens.bgDeep);
|
||||
set("--bg-panel", hexToRgba(tokens.bgPanelSolid, tokens.panelOpacity));
|
||||
set("--bg-panel-solid", tokens.bgPanelSolid);
|
||||
set("--bg-elevated", tokens.bgElevated);
|
||||
set("--bg-hover", bgHover);
|
||||
set("--border", tokens.border);
|
||||
set("--border-bright", borderBright);
|
||||
set("--border-subtle", hexToRgba(tokens.border, 0.55));
|
||||
set("--text", tokens.text);
|
||||
set("--text-dim", tokens.textDim);
|
||||
set("--text-faint", textFaint);
|
||||
set("--brand-blue", tokens.accent);
|
||||
set("--brand-strong", brandStrong);
|
||||
set("--sim-accent", tokens.accent);
|
||||
set("--sim-accent-dim", hexToRgba(tokens.accent, 0.28));
|
||||
set(
|
||||
"--sim-glow",
|
||||
uiEffects ? hexToRgba(tokens.glow, light ? 0.14 : 0.18) : "transparent",
|
||||
);
|
||||
set("--green", tokens.green);
|
||||
set("--amber", tokens.amber);
|
||||
set("--red", tokens.red);
|
||||
set("--violet", tokens.violet);
|
||||
set("--bg-glass", hexToRgba(tokens.bgPanelSolid, Math.min(0.95, tokens.panelOpacity)));
|
||||
set("--bg-inset", hexToRgba(tokens.bgDeep, light ? 0.72 : 0.6));
|
||||
set("--bg-header-fade", light ? "transparent" : hexToRgba(tokens.bgDeep, 0.92));
|
||||
set("--overlay-scrim", light ? "rgba(15, 23, 42, 0.42)" : "rgba(7, 10, 15, 0.84)");
|
||||
set("--badge-bg", light ? tokens.bgPanelSolid : hexToRgba(tokens.bgDeep, 0.72));
|
||||
|
||||
const accentIsLight = isLightHex(tokens.accent);
|
||||
set(
|
||||
"--btn-primary-bg",
|
||||
light ? tokens.accent : hexToRgba(tokens.accent, 0.22),
|
||||
);
|
||||
set(
|
||||
"--btn-primary-hover",
|
||||
light ? brandStrong : hexToRgba(tokens.accent, 0.36),
|
||||
);
|
||||
set(
|
||||
"--btn-primary-text",
|
||||
light ? (accentIsLight ? "#0f172a" : "#ffffff") : mixHex(tokens.accent, "#ffffff", 0.75),
|
||||
);
|
||||
set(
|
||||
"--btn-warn-bg",
|
||||
hexToRgba(tokens.amber, 0.15),
|
||||
);
|
||||
set(
|
||||
"--btn-warn-text",
|
||||
light ? mixHex(tokens.amber, "#000000", 0.35) : mixHex(tokens.amber, "#ffffff", 0.65),
|
||||
);
|
||||
set("--btn-danger-bg", hexToRgba(tokens.red, 0.13));
|
||||
set(
|
||||
"--btn-danger-text",
|
||||
light ? mixHex(tokens.red, "#000000", 0.35) : mixHex(tokens.red, "#ffffff", 0.65),
|
||||
);
|
||||
set(
|
||||
"--btn-ghost-bg",
|
||||
light ? tokens.bgPanelSolid : hexToRgba(tokens.bgPanelSolid, 0.68),
|
||||
);
|
||||
set("--title-color", light ? tokens.text : mixHex(tokens.text, "#ffffff", 0.55));
|
||||
set("--bg-gradient", extras.bgGradient ?? "none");
|
||||
set("--panel-gradient", extras.panelGradient ?? "none");
|
||||
}
|
||||
|
||||
function buildGradientTokens(theme: ThemeConfig): {
|
||||
tokens: CustomThemeTokens;
|
||||
bgGradient: string;
|
||||
panelGradient: string;
|
||||
} {
|
||||
const g = theme.gradient;
|
||||
const s0 = normalizeHex(g.stops[0] ?? "#0b1120", "#0b1120");
|
||||
const s1 = normalizeHex(g.stops[1] ?? "#172554", "#172554");
|
||||
const sLast = normalizeHex(g.stops[g.stops.length - 1] ?? s1, s1);
|
||||
const light = g.surfaceBase === "light";
|
||||
|
||||
const bgDeep = light ? mixHex("#f1f5f9", s0, 0.16) : mixHex("#0b0e14", s0, 0.45);
|
||||
const bgPanelSolid = light
|
||||
? mixHex("#ffffff", s0, 0.08)
|
||||
: mixHex("#111622", s0, 0.42);
|
||||
const bgElevated = light
|
||||
? mixHex("#e2e8f0", s1, 0.14)
|
||||
: mixHex("#182032", s1, 0.4);
|
||||
const border = light
|
||||
? mixHex("#cbd5e1", s1, 0.25)
|
||||
: mixHex("#2a3449", s1, 0.42);
|
||||
|
||||
// Choose an accent that stays legible against the surface base
|
||||
const rawAccent = isLightHex(s1) === light ? sLast : s1;
|
||||
const accent = light
|
||||
? (isLightHex(rawAccent) ? "#0284c7" : rawAccent)
|
||||
: (isLightHex(rawAccent) ? rawAccent : mixHex(rawAccent, "#60a5fa", 0.62));
|
||||
|
||||
const tokens: CustomThemeTokens = {
|
||||
bgDeep,
|
||||
bgPanelSolid,
|
||||
bgElevated,
|
||||
border,
|
||||
text: light ? "#0f172a" : "#e2e8f0",
|
||||
textDim: light ? "#475569" : "#9fb0c7",
|
||||
accent,
|
||||
glow: accent,
|
||||
green: light ? "#059669" : "#34d399",
|
||||
amber: light ? "#d97706" : "#f59e0b",
|
||||
red: light ? "#dc2626" : "#f87171",
|
||||
violet: light ? "#7c3aed" : "#a78bfa",
|
||||
panelOpacity: light ? 0.9 : 0.86,
|
||||
};
|
||||
|
||||
const bgGradient = formatGradientCss(g);
|
||||
const panelGradient = g.applyToPanels
|
||||
? `linear-gradient(155deg, ${hexToRgba(s0, light ? 0.24 : 0.34)}, ${hexToRgba(sLast, light ? 0.16 : 0.22)})`
|
||||
: "none";
|
||||
|
||||
return { tokens, bgGradient, panelGradient };
|
||||
}
|
||||
|
||||
export function applyThemeConfig(
|
||||
theme: ThemeConfig,
|
||||
dispatchEvent = true,
|
||||
): void {
|
||||
const root = document.documentElement;
|
||||
const light =
|
||||
theme.colorSet === "daylight" ||
|
||||
(theme.colorSet === "gradient" && theme.gradient.surfaceBase === "light") ||
|
||||
(theme.colorSet === "custom" && isLightHex(theme.custom.bgDeep));
|
||||
|
||||
root.dataset.shapeSet = theme.shapeSet;
|
||||
root.dataset.colorSet = theme.colorSet;
|
||||
root.dataset.surfacePolarity = light ? "light" : "dark";
|
||||
root.classList.toggle("reduced-ui-effects", !theme.uiEffects);
|
||||
root.classList.toggle("reduced-motion-effects", !theme.motionEffects);
|
||||
document.body.dataset.dynamicTheme = theme.dynamicAccent ? "on" : "off";
|
||||
|
||||
clearCustomCssVars();
|
||||
if (theme.colorSet === "gradient") {
|
||||
const { tokens, bgGradient, panelGradient } = buildGradientTokens(theme);
|
||||
applyDerivedTokens(tokens, theme.uiEffects, { bgGradient, panelGradient });
|
||||
} else if (theme.colorSet === "custom") {
|
||||
applyDerivedTokens(theme.custom, theme.uiEffects);
|
||||
}
|
||||
|
||||
if (dispatchEvent) {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("sgywftp:theme-changed", {
|
||||
detail: { colorMode: s.colorMode, reducedEffects: !!s.reducedEffects },
|
||||
detail: {
|
||||
shapeSet: theme.shapeSet,
|
||||
colorSet: theme.colorSet,
|
||||
uiEffects: theme.uiEffects,
|
||||
motionEffects: theme.motionEffects,
|
||||
dynamicAccent: theme.dynamicAccent,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
export function setColorMode(mode: "dark" | "light"): void {
|
||||
const s = getSettings();
|
||||
s.colorMode = mode;
|
||||
saveSettings(s);
|
||||
applyVisualPreferences();
|
||||
paletteCache = null;
|
||||
}
|
||||
|
||||
export function toggleColorMode(): "dark" | "light" {
|
||||
const next = getColorMode() === "light" ? "dark" : "light";
|
||||
setColorMode(next);
|
||||
return next;
|
||||
}
|
||||
|
||||
export function setReducedEffects(on: boolean): void {
|
||||
const s = getSettings();
|
||||
s.reducedEffects = on;
|
||||
saveSettings(s);
|
||||
applyVisualPreferences();
|
||||
}
|
||||
|
||||
export function toggleReducedEffects(): boolean {
|
||||
const next = !isReducedEffects();
|
||||
setReducedEffects(next);
|
||||
return next;
|
||||
export function applyVisualPreferences(): void {
|
||||
applyThemeConfig(getThemeConfig(), true);
|
||||
}
|
||||
|
||||
export function syncSimulationTheme(opts: {
|
||||
|
|
@ -57,15 +566,9 @@ export function syncSimulationTheme(opts: {
|
|||
target?: string | null;
|
||||
phase?: "idle" | "ascent" | "orbit" | "failed";
|
||||
}): void {
|
||||
const s = getSettings();
|
||||
document.documentElement.dataset.colorMode = s.colorMode;
|
||||
document.documentElement.classList.toggle(
|
||||
"reduced-effects",
|
||||
!!s.reducedEffects,
|
||||
);
|
||||
document.body.dataset.dynamicTheme =
|
||||
s.dynamicTheme && !s.reducedEffects ? "on" : "off";
|
||||
if (s.reducedEffects) {
|
||||
const theme = getThemeConfig();
|
||||
applyThemeConfig(theme, false);
|
||||
if (!theme.dynamicAccent) {
|
||||
document.body.dataset.weather = "nominal";
|
||||
document.body.dataset.target = "earth";
|
||||
document.body.dataset.phase = "idle";
|
||||
|
|
@ -81,3 +584,78 @@ export function syncSimulationTheme(opts: {
|
|||
document.body.dataset.phase = opts.phase;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ResolvedThemePalette {
|
||||
bgDeep: string;
|
||||
bgPanelSolid: string;
|
||||
bgElevated: string;
|
||||
border: string;
|
||||
text: string;
|
||||
textDim: string;
|
||||
accent: string;
|
||||
green: string;
|
||||
amber: string;
|
||||
red: string;
|
||||
violet: string;
|
||||
isLight: boolean;
|
||||
isGradient: boolean;
|
||||
sceneBg: string;
|
||||
sceneBgWithStars: string;
|
||||
daySkyLow: string;
|
||||
}
|
||||
|
||||
let paletteCache: ResolvedThemePalette | null = null;
|
||||
|
||||
export function getThemePalette(): ResolvedThemePalette {
|
||||
if (paletteCache) return paletteCache;
|
||||
const cfg = getThemeConfig();
|
||||
const isLight = isLightSurface();
|
||||
const cs = getComputedStyle(document.documentElement);
|
||||
const bodyCs = getComputedStyle(document.body);
|
||||
const readVar = (name: string, fallback: string) =>
|
||||
cs.getPropertyValue(name).trim() || fallback;
|
||||
const readBodyVar = (name: string, fallback: string) =>
|
||||
bodyCs.getPropertyValue(name).trim() || fallback;
|
||||
|
||||
const bgDeep = readVar("--bg-deep", isLight ? "#f1f5f9" : "#0b0e14");
|
||||
const bgPanelSolid = readVar(
|
||||
"--bg-panel-solid",
|
||||
isLight ? "#ffffff" : "#12161f",
|
||||
);
|
||||
const bgElevated = readVar(
|
||||
"--bg-elevated",
|
||||
isLight ? "#e2e8f0" : "#19202e",
|
||||
);
|
||||
const border = readVar("--border", isLight ? "#cbd5e1" : "#2a3449");
|
||||
const text = readVar("--text", isLight ? "#0f172a" : "#e2e8f0");
|
||||
const textDim = readVar("--text-dim", isLight ? "#475569" : "#94a3b8");
|
||||
const accent = readBodyVar("--sim-accent", isLight ? "#0284c7" : "#60a5fa");
|
||||
const green = readVar("--green", isLight ? "#059669" : "#34d399");
|
||||
const amber = readVar("--amber", isLight ? "#d97706" : "#f59e0b");
|
||||
const red = readVar("--red", isLight ? "#dc2626" : "#f87171");
|
||||
const violet = readVar("--violet", isLight ? "#7c3aed" : "#a78bfa");
|
||||
|
||||
const sceneBg = isLight && cfg.colorSet === "daylight" ? "#dce5f0" : bgDeep;
|
||||
const sceneBgWithStars = isLight ? "#1e293b" : bgDeep;
|
||||
const daySkyLow = isLight ? "#cbdcf0" : mixHex("#0c1a33", bgDeep, 0.35);
|
||||
|
||||
paletteCache = {
|
||||
bgDeep,
|
||||
bgPanelSolid,
|
||||
bgElevated,
|
||||
border,
|
||||
text,
|
||||
textDim,
|
||||
accent,
|
||||
green,
|
||||
amber,
|
||||
red,
|
||||
violet,
|
||||
isLight,
|
||||
isGradient: cfg.colorSet === "gradient",
|
||||
sceneBg,
|
||||
sceneBgWithStars,
|
||||
daySkyLow,
|
||||
};
|
||||
return paletteCache;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Volumetric GLSL shader exhaust plumes, mach shock diamonds (this doesn't look so much better than p1), and altitude/throttle plume scaling.
|
||||
import * as THREE from "three";
|
||||
import { getSoftParticleTexture } from "../sceneManager.js";
|
||||
import { isReducedEffects } from "../../theme.js";
|
||||
import { isReducedMotionEffects } from "../../theme.js";
|
||||
import { getPlumeStyle, type NozzleEmitter } from "./materials.js";
|
||||
|
||||
const PLUME_VERTEX_SHADER = `
|
||||
|
|
@ -76,7 +76,7 @@ export function setPlumeAtmosphere(
|
|||
mat.uniforms.uVacuum.value = vacuum;
|
||||
mat.uniforms.uThrottle.value = thr;
|
||||
if (mat.uniforms.uReduced) {
|
||||
mat.uniforms.uReduced.value = isReducedEffects() ? 1.0 : 0.0;
|
||||
mat.uniforms.uReduced.value = isReducedMotionEffects() ? 1.0 : 0.0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -129,7 +129,7 @@ export function buildStagePlume(
|
|||
uTime: { value: 0 },
|
||||
uVacuum: { value: 0 },
|
||||
uThrottle: { value: 1 },
|
||||
uReduced: { value: isReducedEffects() ? 1.0 : 0.0 },
|
||||
uReduced: { value: isReducedMotionEffects() ? 1.0 : 0.0 },
|
||||
uCoreColor: { value: new THREE.Color(style.core).multiplyScalar(1.35) },
|
||||
uInnerColor: {
|
||||
value: new THREE.Color(style.inner).multiplyScalar(1.15),
|
||||
|
|
@ -153,7 +153,7 @@ export function buildStagePlume(
|
|||
);
|
||||
envelope.position.y = -plumeLen * 0.5;
|
||||
envelope.onBeforeRender = () => {
|
||||
if (!isReducedEffects()) {
|
||||
if (!isReducedMotionEffects()) {
|
||||
shaderMat.uniforms.uTime.value = performance.now() * 0.001;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@ import { RenderPass } from "three/addons/postprocessing/RenderPass.js";
|
|||
import { UnrealBloomPass } from "three/addons/postprocessing/UnrealBloomPass.js";
|
||||
import { OutputPass } from "three/addons/postprocessing/OutputPass.js";
|
||||
import { getSettings } from "../../api.js";
|
||||
import { getColorMode, isReducedEffects } from "../../theme.js";
|
||||
import {
|
||||
getThemePalette,
|
||||
isLightSurface,
|
||||
isReducedMotionEffects,
|
||||
} from "../../theme.js";
|
||||
import {
|
||||
createStudioPMREMCubeTexture,
|
||||
getSoftParticleTexture,
|
||||
|
|
@ -71,7 +75,7 @@ export function createView(
|
|||
let bloomPass: UnrealBloomPass | null = null;
|
||||
let outputPass: OutputPass | null = null;
|
||||
const shouldUseBloom = () =>
|
||||
quality !== "low" && !isReducedEffects() && getColorMode() === "dark";
|
||||
quality !== "low" && !isReducedMotionEffects() && !isLightSurface();
|
||||
try {
|
||||
composer = new EffectComposer(renderer);
|
||||
composer.setPixelRatio(renderer.getPixelRatio());
|
||||
|
|
@ -92,22 +96,24 @@ export function createView(
|
|||
}
|
||||
let hasStars = false;
|
||||
const applyScenePalette = () => {
|
||||
const light = getColorMode() === "light";
|
||||
const reduced = isReducedEffects();
|
||||
const pal = getThemePalette();
|
||||
const reduced = isReducedMotionEffects();
|
||||
if (opts.background !== undefined) {
|
||||
scene.background = new THREE.Color(
|
||||
light && opts.background === 0x0b0e14
|
||||
pal.isLight && opts.background === 0x0b0e14
|
||||
? hasStars
|
||||
? 0x1e293b
|
||||
: 0xdce5f0
|
||||
? pal.sceneBgWithStars
|
||||
: pal.sceneBg
|
||||
: opts.background,
|
||||
);
|
||||
} else if (pal.isGradient) {
|
||||
scene.background = null;
|
||||
} else {
|
||||
scene.background = new THREE.Color(
|
||||
light ? (hasStars ? 0x1e293b : 0xdce5f0) : 0x0b0e14,
|
||||
hasStars ? pal.sceneBgWithStars : pal.sceneBg,
|
||||
);
|
||||
}
|
||||
renderer.toneMappingExposure = light ? (reduced ? 1.0 : 1.06) : 1.12;
|
||||
renderer.toneMappingExposure = pal.isLight ? (reduced ? 1.0 : 1.06) : 1.12;
|
||||
if (bloomPass) {
|
||||
bloomPass.enabled = shouldUseBloom();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,4 +15,5 @@ export {
|
|||
toast,
|
||||
} from "./ui/notifications.js";
|
||||
export { type ModalAction, modal } from "./ui/modal.js";
|
||||
export { openThemeSettingsModal } from "./ui/themeModal.js";
|
||||
export { hideTooltip, initTooltipController, term } from "./ui/tooltip.js";
|
||||
|
|
|
|||
758
src/client/ui/themeModal.ts
Normal file
758
src/client/ui/themeModal.ts
Normal file
|
|
@ -0,0 +1,758 @@
|
|||
// Theme & Appearance Settings modal with live preview, Shape-Sets, Color-Sets,
|
||||
// Customizable Gradients builder, Fully Custom token editor, and comfort toggles.
|
||||
import {
|
||||
DEFAULT_CUSTOM_TOKENS,
|
||||
DEFAULT_THEME_CONFIG,
|
||||
getSettings,
|
||||
normalizeThemeConfig,
|
||||
} from "../api.js";
|
||||
import { applyThemeFromState } from "../state.js";
|
||||
import {
|
||||
applyVisualPreferences,
|
||||
buildCustomTokensFromPreset,
|
||||
COLOR_SET_OPTIONS,
|
||||
type ColorSet,
|
||||
type CustomThemeTokens,
|
||||
formatGradientCss,
|
||||
GRADIENT_STARTERS,
|
||||
normalizeHex,
|
||||
saveThemeConfig,
|
||||
setThemePreview,
|
||||
SHAPE_SET_OPTIONS,
|
||||
type ThemeConfig,
|
||||
} from "../theme.js";
|
||||
import { clear, h } from "./dom.js";
|
||||
import { modal } from "./modal.js";
|
||||
import { toast } from "./notifications.js";
|
||||
|
||||
interface CustomFieldSpec {
|
||||
key: Exclude<keyof CustomThemeTokens, "panelOpacity">;
|
||||
label: string;
|
||||
}
|
||||
|
||||
const CUSTOM_SURFACE_FIELDS: CustomFieldSpec[] = [
|
||||
{ key: "bgDeep", label: "Background Deep" },
|
||||
{ key: "bgPanelSolid", label: "Panel Surface" },
|
||||
{ key: "bgElevated", label: "Elevated Card" },
|
||||
{ key: "border", label: "Border Line" },
|
||||
];
|
||||
|
||||
const CUSTOM_TEXT_FIELDS: CustomFieldSpec[] = [
|
||||
{ key: "text", label: "Primary Text" },
|
||||
{ key: "textDim", label: "Muted Text" },
|
||||
];
|
||||
|
||||
const CUSTOM_ACCENT_FIELDS: CustomFieldSpec[] = [
|
||||
{ key: "accent", label: "Primary Accent" },
|
||||
{ key: "glow", label: "Glow Tint" },
|
||||
{ key: "green", label: "Success / OK" },
|
||||
{ key: "amber", label: "Warning / Amber" },
|
||||
{ key: "red", label: "Danger / Red" },
|
||||
{ key: "violet", label: "Secondary / Violet" },
|
||||
];
|
||||
|
||||
function createColorRow(
|
||||
label: string,
|
||||
initialHex: string,
|
||||
onPick: (hex: string) => void,
|
||||
): HTMLElement {
|
||||
const hexReadout = h("span", { class: "theme-color-hex" }, initialHex);
|
||||
const picker = h("input", {
|
||||
type: "color",
|
||||
class: "theme-color-input",
|
||||
value: normalizeHex(initialHex),
|
||||
onInput: () => {
|
||||
const next = picker.value.toLowerCase();
|
||||
hexReadout.textContent = next;
|
||||
onPick(next);
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
picker.value = normalizeHex(initialHex);
|
||||
return h(
|
||||
"div",
|
||||
{ class: "theme-color-row" },
|
||||
h("span", { class: "theme-color-label" }, label),
|
||||
h("div", { class: "theme-color-picker-wrap" }, picker, hexReadout),
|
||||
);
|
||||
}
|
||||
|
||||
function createPreviewCard(draft: ThemeConfig): HTMLElement {
|
||||
const shapeLabel =
|
||||
SHAPE_SET_OPTIONS.find((s) => s.id === draft.shapeSet)?.label ??
|
||||
draft.shapeSet;
|
||||
const colorLabel =
|
||||
COLOR_SET_OPTIONS.find((c) => c.id === draft.colorSet)?.label ??
|
||||
draft.colorSet;
|
||||
return h(
|
||||
"div",
|
||||
{ class: "theme-preview-card" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "spread" },
|
||||
h(
|
||||
"span",
|
||||
{ class: "mono accent", style: { fontSize: "11px", fontWeight: "700" } },
|
||||
"LIVE TELEMETRY PREVIEW",
|
||||
),
|
||||
h("span", { class: "badge info" }, `${shapeLabel} · ${colorLabel}`),
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px" } },
|
||||
h("span", { class: "badge ok" }, "ORBIT NOMINAL"),
|
||||
h("span", { class: "badge warn" }, "MAX-Q"),
|
||||
h("span", { class: "badge err" }, "ABORT"),
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px" } },
|
||||
h("button", { type: "button", class: "btn xs primary" }, "Launch"),
|
||||
h("button", { type: "button", class: "btn xs" }, "Inspect"),
|
||||
h("button", { type: "button", class: "btn xs warn" }, "Hold"),
|
||||
h("button", { type: "button", class: "btn xs danger" }, "Abort"),
|
||||
h("button", { type: "button", class: "btn xs ghost" }, "Cancel"),
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "dim", style: { fontSize: "11px" } },
|
||||
"Sample muted telemetry readout and border framing across the active theme.",
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
export function openThemeSettingsModal(): void {
|
||||
if (document.querySelector(".theme-modal")) return;
|
||||
|
||||
const initialTheme = structuredClone(getSettings().theme);
|
||||
let draft: ThemeConfig = structuredClone(initialTheme);
|
||||
let jsonEditorOpen = false;
|
||||
|
||||
const applyDraftLive = () => {
|
||||
setThemePreview(draft, false);
|
||||
applyThemeFromState();
|
||||
applyVisualPreferences();
|
||||
};
|
||||
|
||||
const bodyRoot = h("div", { class: "theme-sections" });
|
||||
|
||||
const renderShapeSection = (): HTMLElement =>
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-section" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-section-head" },
|
||||
h("span", { class: "slot-title" }, "Shape-Set"),
|
||||
h(
|
||||
"span",
|
||||
{ class: "mono dim", style: { fontSize: "10px" } },
|
||||
"Corner & framing geometry",
|
||||
),
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-chip-grid" },
|
||||
...SHAPE_SET_OPTIONS.map((opt) =>
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: `theme-chip ${draft.shapeSet === opt.id ? "active" : ""}`,
|
||||
onClick: () => {
|
||||
draft.shapeSet = opt.id;
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-chip-title" },
|
||||
opt.label,
|
||||
draft.shapeSet === opt.id
|
||||
? h("span", { class: "badge info" }, "ACTIVE")
|
||||
: null,
|
||||
),
|
||||
h("div", { class: "theme-chip-sub" }, opt.tagline),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const renderColorSetSection = (): HTMLElement =>
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-section" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-section-head" },
|
||||
h("span", { class: "slot-title" }, "Color-Set"),
|
||||
h(
|
||||
"span",
|
||||
{ class: "mono dim", style: { fontSize: "10px" } },
|
||||
"Presets, gradients & custom palette",
|
||||
),
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-chip-grid" },
|
||||
...COLOR_SET_OPTIONS.map((opt) =>
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: `theme-chip ${draft.colorSet === opt.id ? "active" : ""}`,
|
||||
onClick: () => {
|
||||
draft.colorSet = opt.id;
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-chip-title" },
|
||||
opt.label,
|
||||
draft.colorSet === opt.id
|
||||
? h("span", { class: "badge info" }, "ACTIVE")
|
||||
: null,
|
||||
),
|
||||
h("div", { class: "theme-chip-sub" }, opt.tagline),
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-swatches" },
|
||||
...opt.swatches.map((hex) =>
|
||||
h("span", {
|
||||
class: "theme-swatch",
|
||||
style: { backgroundColor: hex },
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const renderGradientSection = (): HTMLElement => {
|
||||
const g = draft.gradient;
|
||||
const previewStrip = h("div", {
|
||||
class: "theme-gradient-preview",
|
||||
style: { background: formatGradientCss(g) },
|
||||
});
|
||||
const angleLabel = h("span", { class: "mono accent" }, `${g.angle}°`);
|
||||
const angleSlider = h("input", {
|
||||
type: "range",
|
||||
class: "slider",
|
||||
min: 0,
|
||||
max: 360,
|
||||
step: 1,
|
||||
value: g.angle,
|
||||
disabled: g.mode === "radial",
|
||||
onInput: () => {
|
||||
g.angle = Number(angleSlider.value);
|
||||
angleLabel.textContent = `${g.angle}°`;
|
||||
previewStrip.style.background = formatGradientCss(g);
|
||||
applyDraftLive();
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
angleSlider.value = String(g.angle);
|
||||
|
||||
const stopPickers = g.stops.map((stopHex, idx) =>
|
||||
createColorRow(`Stop ${idx + 1}`, stopHex, (nextHex) => {
|
||||
g.stops[idx] = nextHex;
|
||||
previewStrip.style.background = formatGradientCss(g);
|
||||
applyDraftLive();
|
||||
}),
|
||||
);
|
||||
|
||||
const panelGradChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: g.applyToPanels,
|
||||
onChange: () => {
|
||||
g.applyToPanels = panelGradChk.checked;
|
||||
applyDraftLive();
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
|
||||
return h(
|
||||
"div",
|
||||
{ class: "theme-section" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-section-head" },
|
||||
h("span", { class: "slot-title" }, "Customizable Gradients"),
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px" } },
|
||||
g.stops.length < 3
|
||||
? h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs",
|
||||
onClick: () => {
|
||||
g.stops.push("#1e3a8a");
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"+ 3rd Stop",
|
||||
)
|
||||
: h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs ghost",
|
||||
onClick: () => {
|
||||
g.stops.pop();
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"− Remove 3rd Stop",
|
||||
),
|
||||
),
|
||||
),
|
||||
previewStrip,
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px" } },
|
||||
h("span", { class: "mono dim", style: { fontSize: "10px" } }, "Starters:"),
|
||||
...GRADIENT_STARTERS.map((starter) =>
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs ghost",
|
||||
onClick: () => {
|
||||
draft.gradient = {
|
||||
...starter.config,
|
||||
stops: [...starter.config.stops],
|
||||
};
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
starter.label,
|
||||
),
|
||||
),
|
||||
),
|
||||
h("div", { class: "theme-color-grid" }, ...stopPickers),
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "12px" } },
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px" } },
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: `btn xs ${g.mode === "linear" ? "selected" : "ghost"}`,
|
||||
onClick: () => {
|
||||
g.mode = "linear";
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"Linear",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: `btn xs ${g.mode === "radial" ? "selected" : "ghost"}`,
|
||||
onClick: () => {
|
||||
g.mode = "radial";
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"Radial",
|
||||
),
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px" } },
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: `btn xs ${g.surfaceBase === "dark" ? "selected" : "ghost"}`,
|
||||
onClick: () => {
|
||||
g.surfaceBase = "dark";
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"Dark Panels",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: `btn xs ${g.surfaceBase === "light" ? "selected" : "ghost"}`,
|
||||
onClick: () => {
|
||||
g.surfaceBase = "light";
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"Light Panels",
|
||||
),
|
||||
),
|
||||
),
|
||||
h(
|
||||
"div",
|
||||
{ class: "col", style: { gap: "4px" } },
|
||||
h(
|
||||
"div",
|
||||
{ class: "spread" },
|
||||
h(
|
||||
"span",
|
||||
{ class: "mono dim", style: { fontSize: "10px" } },
|
||||
g.mode === "radial" ? "Angle (Linear only)" : "Gradient Angle",
|
||||
),
|
||||
angleLabel,
|
||||
),
|
||||
angleSlider,
|
||||
),
|
||||
h(
|
||||
"label",
|
||||
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
||||
panelGradChk,
|
||||
h("span", {}, "Apply subtle gradient tint to panels & cards"),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
const renderCustomSection = (): HTMLElement => {
|
||||
const c = draft.custom;
|
||||
const seedOptions: Array<{
|
||||
id: Exclude<ColorSet, "gradient" | "custom">;
|
||||
label: string;
|
||||
}> = [
|
||||
{ id: "eyebleed", label: "Eyebleed (Classic)" },
|
||||
{ id: "subtle", label: "Subtle (Eye-Saver)" },
|
||||
{ id: "low-contrast", label: "Low Contrast" },
|
||||
{ id: "catppuccin-mocha", label: "Catppuccin Mocha" },
|
||||
{ id: "daylight", label: "Daylight Light" },
|
||||
];
|
||||
const seedSelect = h(
|
||||
"select",
|
||||
{ class: "input", style: { width: "auto", padding: "4px 8px", fontSize: "11px" } },
|
||||
...seedOptions.map((o) => h("option", { value: o.id }, o.label)),
|
||||
) as HTMLSelectElement;
|
||||
|
||||
const opLabel = h(
|
||||
"span",
|
||||
{ class: "mono accent" },
|
||||
`${Math.round(c.panelOpacity * 100)}%`,
|
||||
);
|
||||
const opSlider = h("input", {
|
||||
type: "range",
|
||||
class: "slider",
|
||||
min: 0.65,
|
||||
max: 1.0,
|
||||
step: 0.01,
|
||||
value: c.panelOpacity,
|
||||
onInput: () => {
|
||||
c.panelOpacity = Number(opSlider.value);
|
||||
opLabel.textContent = `${Math.round(c.panelOpacity * 100)}%`;
|
||||
applyDraftLive();
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
opSlider.value = String(c.panelOpacity);
|
||||
|
||||
const makeGroup = (title: string, fields: CustomFieldSpec[]) =>
|
||||
h(
|
||||
"div",
|
||||
{ class: "col", style: { gap: "6px" } },
|
||||
h("span", { class: "mono dim", style: { fontSize: "10px" } }, title),
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-color-grid" },
|
||||
...fields.map((f) =>
|
||||
createColorRow(f.label, c[f.key], (hex) => {
|
||||
c[f.key] = hex;
|
||||
applyDraftLive();
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
let jsonDrawer: HTMLElement | null = null;
|
||||
if (jsonEditorOpen) {
|
||||
const jsonArea = h("textarea", {
|
||||
class: "input",
|
||||
rows: 5,
|
||||
style: { fontSize: "11px", resize: "vertical" },
|
||||
value: JSON.stringify(c, null, 2),
|
||||
}) as HTMLTextAreaElement;
|
||||
jsonArea.value = JSON.stringify(c, null, 2);
|
||||
jsonDrawer = h(
|
||||
"div",
|
||||
{ class: "col", style: { gap: "6px" } },
|
||||
jsonArea,
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px", justifyContent: "flex-end" } },
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs ghost",
|
||||
onClick: async () => {
|
||||
try {
|
||||
await navigator.clipboard?.writeText(jsonArea.value);
|
||||
toast("Custom theme JSON copied.", "ok");
|
||||
} catch {
|
||||
toast("Select and copy the JSON text directly.", "info");
|
||||
}
|
||||
},
|
||||
},
|
||||
"Copy JSON",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs primary",
|
||||
onClick: () => {
|
||||
try {
|
||||
const parsed = JSON.parse(jsonArea.value);
|
||||
const normalized = normalizeThemeConfig({
|
||||
...draft,
|
||||
custom: parsed,
|
||||
});
|
||||
draft.custom = normalized.custom;
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
toast("Custom theme JSON imported.", "ok");
|
||||
} catch {
|
||||
toast("Invalid custom theme JSON.", "err");
|
||||
}
|
||||
},
|
||||
},
|
||||
"Apply JSON",
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return h(
|
||||
"div",
|
||||
{ class: "theme-section" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-section-head" },
|
||||
h("span", { class: "slot-title" }, "Fully Custom Set"),
|
||||
h(
|
||||
"div",
|
||||
{ class: "row", style: { gap: "6px" } },
|
||||
seedSelect,
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs",
|
||||
onClick: () => {
|
||||
draft.custom = buildCustomTokensFromPreset(
|
||||
seedSelect.value as Exclude<ColorSet, "gradient" | "custom">,
|
||||
);
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"Seed",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs ghost",
|
||||
onClick: () => {
|
||||
jsonEditorOpen = !jsonEditorOpen;
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
jsonEditorOpen ? "Hide JSON" : "JSON",
|
||||
),
|
||||
h(
|
||||
"button",
|
||||
{
|
||||
type: "button",
|
||||
class: "btn xs danger",
|
||||
onClick: () => {
|
||||
draft.custom = { ...DEFAULT_CUSTOM_TOKENS };
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
},
|
||||
},
|
||||
"Reset",
|
||||
),
|
||||
),
|
||||
),
|
||||
makeGroup("Surfaces & Borders", CUSTOM_SURFACE_FIELDS),
|
||||
h(
|
||||
"div",
|
||||
{ class: "col", style: { gap: "4px" } },
|
||||
h(
|
||||
"div",
|
||||
{ class: "spread" },
|
||||
h(
|
||||
"span",
|
||||
{ class: "mono dim", style: { fontSize: "10px" } },
|
||||
"Panel Opacity",
|
||||
),
|
||||
opLabel,
|
||||
),
|
||||
opSlider,
|
||||
),
|
||||
makeGroup("Typography", CUSTOM_TEXT_FIELDS),
|
||||
makeGroup("Accents & Status", CUSTOM_ACCENT_FIELDS),
|
||||
jsonDrawer,
|
||||
);
|
||||
};
|
||||
|
||||
const renderEffectsSection = (): HTMLElement => {
|
||||
const uiFxChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: draft.uiEffects,
|
||||
onChange: () => {
|
||||
draft.uiEffects = uiFxChk.checked;
|
||||
applyDraftLive();
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
|
||||
const motionFxChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: draft.motionEffects,
|
||||
onChange: () => {
|
||||
draft.motionEffects = motionFxChk.checked;
|
||||
applyDraftLive();
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
|
||||
const dynAccentChk = h("input", {
|
||||
type: "checkbox",
|
||||
checked: draft.dynamicAccent,
|
||||
onChange: () => {
|
||||
draft.dynamicAccent = dynAccentChk.checked;
|
||||
applyDraftLive();
|
||||
},
|
||||
}) as HTMLInputElement;
|
||||
|
||||
return h(
|
||||
"div",
|
||||
{ class: "theme-section" },
|
||||
h(
|
||||
"div",
|
||||
{ class: "theme-section-head" },
|
||||
h("span", { class: "slot-title" }, "Visual Effects & Motion"),
|
||||
h(
|
||||
"span",
|
||||
{ class: "mono dim", style: { fontSize: "10px" } },
|
||||
"Independent of color-set",
|
||||
),
|
||||
),
|
||||
h(
|
||||
"label",
|
||||
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
||||
uiFxChk,
|
||||
h(
|
||||
"span",
|
||||
{},
|
||||
"UI Glows, Backdrop Blur, Shadows & Background Grid",
|
||||
),
|
||||
),
|
||||
h(
|
||||
"label",
|
||||
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
||||
motionFxChk,
|
||||
h(
|
||||
"span",
|
||||
{},
|
||||
"Animations, 3D Bloom, Camera Shake & Plume Shimmer",
|
||||
),
|
||||
),
|
||||
h(
|
||||
"label",
|
||||
{ class: "row", style: { cursor: "pointer", fontSize: "12px" } },
|
||||
dynAccentChk,
|
||||
h(
|
||||
"span",
|
||||
{},
|
||||
"Dynamic Simulation Accent (shifts with space weather & target)",
|
||||
),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
const renderModalBody = () => {
|
||||
clear(bodyRoot);
|
||||
bodyRoot.append(
|
||||
createPreviewCard(draft),
|
||||
renderShapeSection(),
|
||||
renderColorSetSection(),
|
||||
);
|
||||
if (draft.colorSet === "gradient") bodyRoot.append(renderGradientSection());
|
||||
if (draft.colorSet === "custom") bodyRoot.append(renderCustomSection());
|
||||
bodyRoot.append(renderEffectsSection());
|
||||
};
|
||||
|
||||
renderModalBody();
|
||||
|
||||
const cleanupEscape = () => {
|
||||
window.removeEventListener("keydown", onKeyDown);
|
||||
};
|
||||
|
||||
const revertAndClose = () => {
|
||||
cleanupEscape();
|
||||
setThemePreview(null, false);
|
||||
applyThemeFromState();
|
||||
applyVisualPreferences();
|
||||
m.close();
|
||||
};
|
||||
|
||||
const onKeyDown = (ev: KeyboardEvent) => {
|
||||
if (ev.key === "Escape") {
|
||||
ev.preventDefault();
|
||||
revertAndClose();
|
||||
}
|
||||
};
|
||||
window.addEventListener("keydown", onKeyDown);
|
||||
|
||||
const m = modal("Theme & Appearance Settings", bodyRoot, [
|
||||
{
|
||||
label: "Reset Defaults",
|
||||
kind: "ghost",
|
||||
onClick: () => {
|
||||
draft = structuredClone(DEFAULT_THEME_CONFIG);
|
||||
applyDraftLive();
|
||||
renderModalBody();
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Cancel",
|
||||
kind: "ghost",
|
||||
onClick: () => {
|
||||
cleanupEscape();
|
||||
setThemePreview(null, false);
|
||||
applyThemeFromState();
|
||||
applyVisualPreferences();
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Save & Apply",
|
||||
kind: "primary",
|
||||
onClick: () => {
|
||||
cleanupEscape();
|
||||
saveThemeConfig(draft);
|
||||
applyThemeFromState();
|
||||
applyVisualPreferences();
|
||||
toast("Theme settings saved.", "ok");
|
||||
},
|
||||
},
|
||||
]);
|
||||
m.el.classList.add("theme-modal");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue