diff --git a/README.md b/README.md index 9a678c2..03bb94a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Timelog -A private, minimal time log with a duration-first timer, offline PWA, Forest CSV import/export, and time trends by day, week, month, year, and tag. The terminal-style UI offers Catppuccin Mocha and Latte themes, with the choice saved on each device. There is no tree or streak system. +A private, minimal time log with a duration-first timer, offline PWA, Forest CSV import/export, and time trends by day, week, month, year, and tag. The terminal-style UI offers Nord (the default) and Catppuccin Mocha and Latte themes, with the choice saved on each device. There is no tree or streak system. ## Run locally diff --git a/src/client/index.html b/src/client/index.html index 8785a34..cdecd2d 100644 --- a/src/client/index.html +++ b/src/client/index.html @@ -3,7 +3,7 @@
- + @@ -12,10 +12,17 @@ diff --git a/src/client/main.ts b/src/client/main.ts index ef72679..2689d2f 100644 --- a/src/client/main.ts +++ b/src/client/main.ts @@ -6,15 +6,16 @@ import { dueMs, recordEnd, type TimeRecord } from "../shared/record.ts"; import { normalizeTag } from "../shared/tag.ts"; import { countdown, pad, pageTitle } from "./title.ts"; import { readyToReload } from "./update.ts"; +import { THEMES, THEME_COLORS, isTheme, type Theme } from "./theme.ts"; type View = "timer" | "log" | "insights" | "settings"; -type Theme = "latte" | "mocha"; type Me = { authenticated: boolean; dev: boolean; githubConfigured: boolean; vapidPublicKey: string | null }; const app = document.getElementById("app")!; let records: TimeRecord[] = []; let view: View = "timer"; -let theme: Theme = document.documentElement.dataset.theme === "latte" ? "latte" : "mocha"; +const startTheme = document.documentElement.dataset.theme; +let theme: Theme = isTheme(startTheme) ? startTheme : "nord"; let me: Me | null = null; let syncStatus: SyncStatus = navigator.onLine ? "pending" : "offline"; let selectedTag = normalizeTag(localStorage.getItem("timelog-last-tag") || "Study"); @@ -65,7 +66,7 @@ function markSignedOut() { function setTheme(next: Theme) { theme = next; document.documentElement.dataset.theme = next; - document.querySelector('meta[name="theme-color"]')?.setAttribute("content", next === "latte" ? "#e6e9ef" : "#1e1e2e"); + document.querySelector('meta[name="theme-color"]')?.setAttribute("content", THEME_COLORS[next]); localStorage.setItem("timelog-theme", next); render(); } @@ -232,7 +233,7 @@ function settingsPage() { const permission = "Notification" in window ? Notification.permission : "unsupported"; return `Catppuccin colors. Saved on this device.
Nord and Catppuccin colors. Saved on this device.
Bring in your existing sessions. Re-importing the same file skips duplicates.
Download your completed sessions with Forest's six-column layout.
${permission === "denied" ? "Blocked in your device settings." : !canNotify ? "On iPhone, add Timelog to your Home Screen, then open it there to enable alerts." : permission === "granted" ? "Permission granted on this device. Reconnect if alerts stop arriving." : "Get an alert when a session reaches its duration. On iPhone, open Timelog from your Home Screen first."}