Files
ai-terminal-assistant/packages/web/index.html
T
kurihada 5b7b0ff1e4 feat(ui): 实现深色/浅色主题切换功能
- 添加 CSS 变量定义浅色和深色主题色板
- 扩展 Tailwind 配置支持语义化颜色 (surface-*, fg-*, line-*, code)
- 创建 useTheme hook 管理主题状态和持久化
- 创建 ThemeToggle 组件支持三种模式 (light/dark/system)
- 迁移所有组件从硬编码 gray-* 到语义化颜色
- 支持系统主题偏好检测 (prefers-color-scheme)
- 添加主题初始化脚本防止闪烁 (FOUC)
2025-12-15 15:47:32 +08:00

40 lines
1.6 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, maximum-scale=1.0, user-scalable=no" />
<!-- PWA Meta Tags -->
<meta name="theme-color" content="#111827" media="(prefers-color-scheme: dark)" />
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="AI Assistant" />
<meta name="description" content="AI Terminal Assistant - Your intelligent coding companion" />
<!-- Apple Touch Icons (use SVG as fallback) -->
<link rel="apple-touch-icon" href="/icon.svg" />
<!-- PWA Manifest -->
<link rel="manifest" href="/manifest.json" />
<title>AI Assistant</title>
<!-- Theme initialization script (prevents flash) -->
<script>
(function() {
const STORAGE_KEY = 'ai-assistant-theme';
const stored = localStorage.getItem(STORAGE_KEY);
const theme = stored === 'light' || stored === 'dark' ? stored : 'system';
const isDark = theme === 'dark' || (theme === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches);
document.documentElement.classList.toggle('dark', isDark);
})();
</script>
</head>
<body class="bg-surface-base text-fg">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>