feat(rembg): add RemoveBG Studio - native background removal app
C++ WebView2 host app driving a Python/rembg engine as a JSON-stdio sidecar, with live before/after preview for images and video frames. Also includes the original CLI (removebg.py) built on the same core/ engine. The WebView2 SDK is fetched on demand via native/third_party/fetch-webview2.ps1 (wired into the Makefile) rather than vendored, since it's ~15MB of prebuilt/generated Microsoft SDK content. A Makefile provides make sync/build/run/clean as the standard entry points.
This commit is contained in:
@@ -0,0 +1,535 @@
|
||||
:root {
|
||||
--bg-app: #16161a;
|
||||
--bg-rail: #101013;
|
||||
--bg-toolbar: #191a1e;
|
||||
--bg-stage: #0d0d10;
|
||||
--bg-panel: #191a1e;
|
||||
--bg-field: #0f0f12;
|
||||
--bg-statusbar: #101013;
|
||||
--line: rgba(255, 255, 255, 0.07);
|
||||
--line-strong: rgba(255, 255, 255, 0.13);
|
||||
--ink: #e9e8ee;
|
||||
--ink-dim: #97959f;
|
||||
--ink-faint: #66646d;
|
||||
--accent: #7c6bff;
|
||||
--accent-dim: rgba(124, 107, 255, 0.16);
|
||||
--good: #3fd692;
|
||||
--bad: #ff6b6b;
|
||||
--ease: cubic-bezier(0.2, 0.7, 0.2, 1);
|
||||
--radius: 8px;
|
||||
font-family: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
/* The [hidden] attribute must always win over component display rules —
|
||||
several components below (.stage-empty, .compare, etc.) set their own
|
||||
`display` unconditionally, which otherwise silences the UA default. */
|
||||
[hidden] { display: none !important; }
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
background: var(--bg-app);
|
||||
color: var(--ink);
|
||||
overflow: hidden;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body { font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; height: 100vh; }
|
||||
|
||||
button, select, input { font-family: inherit; }
|
||||
|
||||
::selection { background: var(--accent-dim); }
|
||||
::-webkit-scrollbar { width: 9px; height: 9px; }
|
||||
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
|
||||
/* ---------------------------------------------------------------- app shell */
|
||||
|
||||
.app {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.rail {
|
||||
width: 52px;
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 16px 0;
|
||||
background: var(--bg-rail);
|
||||
border-right: 1px solid var(--line);
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
|
||||
.rail-mark {
|
||||
width: 30px; height: 30px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
color: var(--accent);
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.rail-btn {
|
||||
-webkit-app-region: no-drag;
|
||||
width: 36px; height: 36px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
border-left: 2px solid transparent;
|
||||
color: var(--ink-faint);
|
||||
cursor: pointer;
|
||||
transition: color 0.2s var(--ease), background 0.2s var(--ease);
|
||||
}
|
||||
.rail-btn svg { width: 18px; height: 18px; }
|
||||
.rail-btn:hover { color: var(--ink-dim); background: rgba(255,255,255,0.03); }
|
||||
.rail-btn.is-active { color: var(--ink); background: rgba(255,255,255,0.045); border-left-color: var(--accent); }
|
||||
|
||||
.rail-spacer { flex: 1; }
|
||||
|
||||
.rail-status { -webkit-app-region: no-drag; padding-bottom: 2px; }
|
||||
.rail-status .dot {
|
||||
display: block; width: 7px; height: 7px; border-radius: 50%;
|
||||
background: #4a4a52;
|
||||
transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease);
|
||||
}
|
||||
.rail-status.ready .dot { background: var(--good); box-shadow: 0 0 6px 0 rgba(63, 214, 146, 0.5); }
|
||||
.rail-status.busy .dot { background: var(--accent); box-shadow: 0 0 6px 0 rgba(124,107,255,0.6); animation: pulse 1.3s ease-in-out infinite; }
|
||||
.rail-status.error .dot { background: var(--bad); box-shadow: 0 0 6px 0 rgba(255,107,107,0.5); }
|
||||
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
|
||||
|
||||
/* ---------------------------------------------------------------- main / toolbar */
|
||||
|
||||
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
||||
|
||||
.toolbar {
|
||||
flex: 0 0 auto;
|
||||
height: 46px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 16px;
|
||||
background: var(--bg-toolbar);
|
||||
border-bottom: 1px solid var(--line);
|
||||
-webkit-app-region: drag;
|
||||
}
|
||||
|
||||
.toolbar h1 { font-size: 13px; font-weight: 600; margin: 0; letter-spacing: 0.01em; }
|
||||
.toolbar-actions { -webkit-app-region: no-drag; }
|
||||
|
||||
.seg { display: inline-flex; padding: 2px; border-radius: 7px; background: rgba(0,0,0,0.3); border: 1px solid var(--line); }
|
||||
.seg-btn {
|
||||
border: none; background: transparent; color: var(--ink-dim);
|
||||
padding: 5px 12px; border-radius: 5px; font-size: 12px; cursor: pointer;
|
||||
transition: background 0.2s var(--ease), color 0.2s var(--ease);
|
||||
}
|
||||
.seg-btn:hover { color: var(--ink); }
|
||||
.seg-btn.is-active { background: rgba(255,255,255,0.09); color: var(--ink); }
|
||||
|
||||
/* ---------------------------------------------------------------- workspace */
|
||||
|
||||
.workspace { flex: 1; min-height: 0; display: flex; }
|
||||
|
||||
.stage {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
background: var(--bg-stage);
|
||||
background-image:
|
||||
linear-gradient(var(--line) 1px, transparent 1px),
|
||||
linear-gradient(90deg, var(--line) 1px, transparent 1px);
|
||||
background-size: 28px 28px;
|
||||
background-position: -1px -1px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.stage[hidden] { display: none; }
|
||||
|
||||
.stage-empty {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
width: 44px; height: 44px;
|
||||
border-radius: 10px;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
color: var(--ink-faint);
|
||||
border: 1px solid var(--line-strong);
|
||||
background: rgba(255,255,255,0.02);
|
||||
}
|
||||
.empty-icon svg { width: 20px; height: 20px; }
|
||||
|
||||
.empty-hint { color: var(--ink-faint); font-size: 11.5px; }
|
||||
|
||||
.ghost-btn {
|
||||
padding: 8px 16px;
|
||||
border-radius: var(--radius);
|
||||
background: rgba(255,255,255,0.04);
|
||||
border: 1px solid var(--line-strong);
|
||||
color: var(--ink);
|
||||
font-size: 12.5px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s var(--ease);
|
||||
}
|
||||
.ghost-btn:hover { background: rgba(255,255,255,0.08); }
|
||||
.ghost-btn:active { transform: scale(0.98); }
|
||||
|
||||
/* compare / before-after */
|
||||
|
||||
.compare { flex: 1; min-height: 0; padding: 18px; display: flex; flex-direction: column; }
|
||||
.compare[hidden] { display: none; }
|
||||
|
||||
.compare-stage {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--line-strong);
|
||||
cursor: ew-resize;
|
||||
touch-action: none;
|
||||
--split: 50;
|
||||
}
|
||||
|
||||
.checker {
|
||||
position: absolute; inset: 0;
|
||||
background-image:
|
||||
linear-gradient(45deg, #2a2a30 25%, transparent 25%, transparent 75%, #2a2a30 75%),
|
||||
linear-gradient(45deg, #2a2a30 25%, #1c1c20 25%, #1c1c20 75%, #2a2a30 75%);
|
||||
background-size: 20px 20px;
|
||||
background-position: 0 0, 10px 10px;
|
||||
}
|
||||
|
||||
.layer {
|
||||
position: absolute; inset: 0;
|
||||
width: 100%; height: 100%;
|
||||
object-fit: contain;
|
||||
-webkit-user-drag: none;
|
||||
user-select: none;
|
||||
}
|
||||
/* Left of the handle shows the original ("Before"), right shows the result
|
||||
("After") — matching the .tag-before / .tag-after label positions. */
|
||||
.layer-original { clip-path: inset(0 calc(100% - var(--split) * 1%) 0 0); }
|
||||
.layer-processed { clip-path: inset(0 0 0 calc(var(--split) * 1%)); }
|
||||
|
||||
/* The visible line is 2px, but the actual pointer hit-zone is much wider
|
||||
(and centered on the line via translateX) so the divider is easy to grab
|
||||
without pixel-precise aim. Dragging can also start anywhere on the image
|
||||
(see .compare-stage pointerdown in app.js) — the handle itself is just
|
||||
the visual affordance. */
|
||||
.handle {
|
||||
position: absolute; top: 0; bottom: 0;
|
||||
left: calc(var(--split) * 1%);
|
||||
width: 40px;
|
||||
transform: translateX(-50%);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
cursor: ew-resize;
|
||||
touch-action: none;
|
||||
}
|
||||
.handle::before {
|
||||
content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
|
||||
transform: translateX(-1px);
|
||||
background: rgba(255,255,255,0.7);
|
||||
transition: width 0.15s var(--ease), background 0.15s var(--ease);
|
||||
}
|
||||
.handle:hover::before, .handle.is-dragging::before {
|
||||
width: 3px;
|
||||
background: rgba(255,255,255,0.95);
|
||||
}
|
||||
.handle-grip {
|
||||
width: 30px; height: 30px;
|
||||
border-radius: 50%;
|
||||
background: rgba(20,20,24,0.85);
|
||||
border: 1px solid rgba(255,255,255,0.35);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
transition: transform 0.15s var(--ease), background 0.15s var(--ease);
|
||||
}
|
||||
.handle:hover .handle-grip, .handle.is-dragging .handle-grip {
|
||||
transform: scale(1.1);
|
||||
background: rgba(30,26,50,0.95);
|
||||
border-color: rgba(124,107,255,0.7);
|
||||
}
|
||||
.handle-grip::before, .handle-grip::after {
|
||||
content: ""; position: absolute; top: 50%; width: 5px; height: 5px;
|
||||
border-top: 1.4px solid rgba(255,255,255,0.75);
|
||||
border-right: 1.4px solid rgba(255,255,255,0.75);
|
||||
transform: translateY(-50%) rotate(-45deg);
|
||||
}
|
||||
.handle-grip::before { left: 7px; }
|
||||
.handle-grip::after { right: 7px; transform: translateY(-50%) rotate(135deg); }
|
||||
|
||||
.tag {
|
||||
position: absolute; top: 10px;
|
||||
padding: 3px 9px;
|
||||
border-radius: 5px;
|
||||
background: rgba(10,10,12,0.65);
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
font-size: 10.5px;
|
||||
color: var(--ink-dim);
|
||||
pointer-events: none;
|
||||
}
|
||||
.tag-before { left: 10px; }
|
||||
.tag-after { right: 10px; }
|
||||
|
||||
/* loading */
|
||||
|
||||
.stage-loading {
|
||||
flex: 1;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
gap: 10px;
|
||||
color: var(--ink-faint);
|
||||
font-size: 12px;
|
||||
}
|
||||
.stage-loading[hidden] { display: none; }
|
||||
|
||||
.spinner {
|
||||
width: 14px; height: 14px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid rgba(255,255,255,0.15);
|
||||
border-top-color: var(--accent);
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.stage-toolbar {
|
||||
flex: 0 0 auto;
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding-top: 10px;
|
||||
color: var(--ink-faint);
|
||||
font-size: 11.5px;
|
||||
}
|
||||
|
||||
.mini-btn {
|
||||
background: rgba(255,255,255,0.05);
|
||||
border: 1px solid var(--line-strong);
|
||||
color: var(--ink-dim);
|
||||
border-radius: 6px;
|
||||
padding: 5px 11px;
|
||||
font-size: 11.5px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s var(--ease), color 0.2s var(--ease);
|
||||
}
|
||||
.mini-btn:hover { background: rgba(255,255,255,0.09); color: var(--ink); }
|
||||
|
||||
/* batch list */
|
||||
|
||||
.batch-list { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 18px; }
|
||||
.batch-list[hidden] { display: none; }
|
||||
.batch-list-head { color: var(--ink-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 10px; }
|
||||
.batch-list-body { flex: 1; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: rgba(0,0,0,0.15); }
|
||||
.batch-row {
|
||||
display: flex; align-items: center; gap: 8px;
|
||||
padding: 8px 12px;
|
||||
font-size: 12px;
|
||||
color: var(--ink-dim);
|
||||
border-bottom: 1px solid var(--line);
|
||||
font-family: "Cascadia Code", "Consolas", monospace;
|
||||
}
|
||||
.batch-row:last-child { border-bottom: none; }
|
||||
|
||||
/* ---------------------------------------------------------------- panel */
|
||||
|
||||
.panel {
|
||||
width: 280px;
|
||||
flex: 0 0 auto;
|
||||
background: var(--bg-panel);
|
||||
border-left: 1px solid var(--line);
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.panel[hidden] { display: none; }
|
||||
|
||||
.panel-section { display: flex; flex-direction: column; gap: 8px; }
|
||||
.panel-spacer { flex: 1; min-height: 12px; }
|
||||
|
||||
.divider { height: 1px; background: var(--line); margin: 14px 0; flex: 0 0 auto; }
|
||||
|
||||
.panel-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
|
||||
.panel-hint { margin: 0; color: var(--ink-faint); font-size: 11px; }
|
||||
|
||||
.row-btn {
|
||||
width: 100%;
|
||||
padding: 8px 10px;
|
||||
border-radius: 6px;
|
||||
background: rgba(255,255,255,0.045);
|
||||
border: 1px solid var(--line-strong);
|
||||
color: var(--ink);
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s var(--ease);
|
||||
}
|
||||
.row-btn:hover { background: rgba(255,255,255,0.08); }
|
||||
|
||||
.path-line {
|
||||
font-family: "Cascadia Code", "Consolas", monospace;
|
||||
font-size: 11px;
|
||||
color: var(--ink-faint);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding: 0 2px;
|
||||
}
|
||||
.path-line.has-value { color: var(--ink-dim); }
|
||||
|
||||
.full-select {
|
||||
width: 100%;
|
||||
background: var(--bg-field);
|
||||
border: 1px solid var(--line-strong);
|
||||
color: var(--ink);
|
||||
padding: 7px 9px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.panel-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
|
||||
.panel-field span { color: var(--ink-dim); font-size: 12px; }
|
||||
.panel-field select, .glass-input {
|
||||
background: var(--bg-field);
|
||||
border: 1px solid var(--line-strong);
|
||||
color: var(--ink);
|
||||
padding: 6px 9px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
outline: none;
|
||||
min-width: 118px;
|
||||
}
|
||||
.glass-input { min-width: 90px; }
|
||||
.panel-field select:focus, .full-select:focus, .glass-input:focus { border-color: rgba(124,107,255,0.55); }
|
||||
|
||||
.swatch-row { display: flex; gap: 8px; }
|
||||
.swatch-btn {
|
||||
width: 30px; height: 30px;
|
||||
border-radius: 7px;
|
||||
padding: 3px;
|
||||
background: transparent;
|
||||
border: 1px solid var(--line-strong);
|
||||
cursor: pointer;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
transition: border-color 0.2s var(--ease), transform 0.15s var(--ease);
|
||||
}
|
||||
.swatch-btn:hover { transform: translateY(-1px); }
|
||||
.swatch-btn.is-active { border-color: var(--accent); }
|
||||
.swatch {
|
||||
width: 100%; height: 100%;
|
||||
border-radius: 4px;
|
||||
display: block;
|
||||
}
|
||||
.checker-swatch {
|
||||
background-image:
|
||||
linear-gradient(45deg, #3a3a42 25%, transparent 25%, transparent 75%, #3a3a42 75%),
|
||||
linear-gradient(45deg, #3a3a42 25%, #24242a 25%, #24242a 75%, #3a3a42 75%);
|
||||
background-size: 8px 8px;
|
||||
background-position: 0 0, 4px 4px;
|
||||
}
|
||||
|
||||
.switch-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
color: var(--ink-dim);
|
||||
}
|
||||
.switch {
|
||||
width: 32px; height: 19px;
|
||||
border-radius: 999px;
|
||||
background: rgba(0,0,0,0.4);
|
||||
border: 1px solid var(--line-strong);
|
||||
position: relative;
|
||||
flex: 0 0 auto;
|
||||
transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
|
||||
}
|
||||
.switch .knob {
|
||||
position: absolute; top: 1px; left: 1px;
|
||||
width: 15px; height: 15px;
|
||||
border-radius: 50%;
|
||||
background: var(--ink-faint);
|
||||
transition: transform 0.25s var(--ease), background 0.25s var(--ease);
|
||||
}
|
||||
.switch.is-on { background: rgba(124,107,255,0.5); border-color: rgba(124,107,255,0.65); }
|
||||
.switch.is-on .knob { transform: translateX(13px); background: #fff; }
|
||||
|
||||
.primary-btn {
|
||||
margin-top: 14px;
|
||||
width: 100%;
|
||||
border: none;
|
||||
border-radius: 7px;
|
||||
padding: 10px 0;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: filter 0.2s var(--ease), transform 0.15s var(--ease);
|
||||
}
|
||||
.primary-btn:hover { filter: brightness(1.08); }
|
||||
.primary-btn:active { transform: scale(0.985); }
|
||||
.primary-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
|
||||
|
||||
/* ---------------------------------------------------------------- statusbar */
|
||||
|
||||
.statusbar {
|
||||
flex: 0 0 auto;
|
||||
height: 26px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 0 12px;
|
||||
background: var(--bg-statusbar);
|
||||
border-top: 1px solid var(--line);
|
||||
font-size: 11px;
|
||||
color: var(--ink-faint);
|
||||
}
|
||||
|
||||
.statusbar-track {
|
||||
width: 90px;
|
||||
height: 3px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255,255,255,0.08);
|
||||
overflow: hidden;
|
||||
}
|
||||
.statusbar-fill {
|
||||
height: 100%; width: 0%;
|
||||
background: var(--accent);
|
||||
transition: width 0.4s var(--ease);
|
||||
}
|
||||
|
||||
.statusbar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
.statusbar-log {
|
||||
background: none; border: none; color: var(--ink-faint);
|
||||
font-size: 11px; display: flex; align-items: center; gap: 4px;
|
||||
cursor: pointer; padding: 3px;
|
||||
}
|
||||
.statusbar-log svg { width: 10px; height: 10px; transition: transform 0.25s var(--ease); }
|
||||
.statusbar-log.is-open svg { transform: rotate(180deg); }
|
||||
|
||||
.log-drawer {
|
||||
position: fixed;
|
||||
left: 0; right: 0; bottom: 26px;
|
||||
max-height: 0;
|
||||
overflow-y: auto;
|
||||
background: rgba(10,10,12,0.97);
|
||||
border-top: 1px solid var(--line);
|
||||
transition: max-height 0.3s var(--ease);
|
||||
font-family: "Cascadia Code", "Consolas", monospace;
|
||||
font-size: 11px;
|
||||
color: var(--ink-faint);
|
||||
z-index: 5;
|
||||
}
|
||||
.log-drawer.is-open { max-height: 180px; }
|
||||
.log-drawer div { padding: 3px 14px; white-space: pre-wrap; word-break: break-word; }
|
||||
.log-drawer div.is-error { color: var(--bad); }
|
||||
Reference in New Issue
Block a user