Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Show the Kokon mark from the first frame instead of a blank window

Gabriele Lozupone0b3bc7dcdc68
diff --git a/index.html b/index.html
index 9f50fdc..cd08b09 100644
--- a/index.html
+++ b/index.html
@@ -4,9 +4,24 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Kokon</title>
+ <!-- Painted before any JavaScript runs, so the window never shows an empty white page
+ (the dev server can take seconds to compile; the web view itself needs a moment).
+ React replaces #root's content when the app mounts. Colors match styles.css. -->
+ <style>
+ html, body { margin: 0; height: 100%; background: #ffffff; color: #0d0d0d; }
+ @media (prefers-color-scheme: dark) { html, body { background: #161616; color: #ececec; } }
+ .boot-splash { height: 100vh; display: grid; place-items: center; }
+ .boot-splash svg { width: 56px; height: 56px; opacity: 0.9; animation: boot-breathe 1.6s ease-in-out infinite; }
+ @keyframes boot-breathe { 50% { opacity: 0.35; } }
+ @media (prefers-reduced-motion: reduce) { .boot-splash svg { animation: none; } }
+ </style>
</head>
<body>
- <div id="root"></div>
+ <div id="root">
+ <div class="boot-splash" aria-label="Kokon is starting">
+ <svg viewBox="0 0 1024 1024" aria-hidden="true"><path fill="currentColor" d="M0.00 242.81 C0.00 112.17 70.23 25.08 175.59 25.08 C280.94 25.08 351.17 112.17 351.17 242.81 L351.17 781.19 C351.17 911.83 280.94 998.92 175.59 998.92 C70.23 998.92 0.00 911.83 0.00 781.19 Z M389.53 548.95 C389.53 250.35 662.35 25.08 1024.00 25.08 C1024.00 323.68 751.18 548.95 389.53 548.95 Z M389.53 587.31 C389.53 821.93 618.71 998.92 922.49 998.92 C922.49 764.30 693.31 587.31 389.53 587.31 Z"/></svg>
+ </div>
+ </div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
diff --git a/src/App.tsx b/src/App.tsx
index a66799d..6ec7865 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,5 +1,5 @@
import { getCurrentWebview } from "@tauri-apps/api/webview";
-import { EyeOff, Loader2, PanelLeft, Redo2, Settings, SquarePen, Undo2, X } from "lucide-react";
+import { EyeOff, PanelLeft, Redo2, Settings, SquarePen, Undo2, X } from "lucide-react";
import { useEffect, useState } from "react";
import { api, configure } from "./lib/api";
import { native } from "./lib/native";
@@ -16,7 +16,7 @@ import { ProjectTitle, Sidebar } from "./components/Sidebar";
import { Stage } from "./components/Stage";
import { IconButton } from "./components/ui";
import { shortcut } from "./lib/platform";
-import { Welcome } from "./components/Welcome";
+import { KokonMark, Welcome } from "./components/Welcome";
const IMAGE_EXT = /\.(png|jpe?g|webp|bmp|gif|tiff?|heic|heif)$/i;
@@ -80,6 +80,22 @@ function HistoryButtons() {
);
}
+/** Same breathing mark as the HTML splash in index.html, so startup looks like one step;
+ * a line of text appears if connecting to the local service takes a while. */
+function BootSplash() {
+ const [slow, setSlow] = useState(false);
+ useEffect(() => {
+ const t = window.setTimeout(() => setSlow(true), 3000);
+ return () => window.clearTimeout(t);
+ }, []);
+ return (
+ <div className="boot-splash">
+ <KokonMark size={56} />
+ <span className={`muted boot-text ${slow ? "on" : ""}`}>Starting Kokon…</span>
+ </div>
+ );
+}
+
function PrivateToggle() {
const on = useStore((s) => s.privateMode);
const toggle = () => setPrivateMode(!on, () => native.confirm("Turn off private mode? The images made in private mode will be deleted.", "Private mode"));
@@ -247,7 +263,7 @@ export default function App() {
return (
<div className="app" style={{ display: "grid", placeItems: "center" }}>
{boot === "connecting" ? (
- <Loader2 className="spin" size={22} />
+ <BootSplash />
) : (
<div className="failed">
<strong>Could not start the local service</strong>
diff --git a/src/styles.css b/src/styles.css
index 313f989..2ac9084 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -479,3 +479,11 @@ pre.diag { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font
.ready-tips { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; background: var(--surface); border-radius: 14px; font-size: 13px; line-height: 1.5; }
.ready-tips ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
@media (prefers-reduced-motion: reduce) { .welcome, .showcase-media img, .showcase-media video { animation: none; } }
+
+/* Startup: continues the HTML splash of index.html. */
+.boot-splash { display: flex; flex-direction: column; align-items: center; gap: 18px; }
+.boot-splash .kokon-mark { animation: boot-breathe 1.6s ease-in-out infinite; opacity: 0.9; }
+.boot-text { font-size: 13px; opacity: 0; transition: opacity 0.4s; }
+.boot-text.on { opacity: 1; }
+@keyframes boot-breathe { 50% { opacity: 0.35; } }
+@media (prefers-reduced-motion: reduce) { .boot-splash .kokon-mark { animation: none; } }