Files
monkey-ai-web/src/styles/tokens.css
T
2026-10-15 16:33:46 +08:00

159 lines
7.0 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* 主题语义 token 定义
*
* 这是默认主题(preset=default)的兜底值,确保即使 JS 注入失败或
* applyThemeFromCache 命中前的第一帧渲染也是正确的视觉。
*
* 运行时若加载了非默认预设,helpers/theme.js 会用 <style> 标签
* 注入更高优先级的同名变量覆盖这里的默认值。
*
* 命名规约:
* --brand-* : 品牌核心
* --accent-* : 强调辅助色
* --surface-* : 背景层
* --text-* : 文本
* --border-* : 边框
*
* 双选择器(html.dark, body[theme-mode="dark"])兼容 Tailwind 与 Semi
* 两套暗色模式切换机制。
*/
:root {
/* === 品牌色 ===
* 每个核心色都额外暴露 *-rgb 三元组("R G B" 空格分隔,无逗号无 rgb() 包装),
* 供 tailwind.config.js 用 `rgb(var(--*-rgb) / <alpha-value>)` 模式生成
* 支持透明度后缀的工具类(如 bg-brand/20、text-brand-from/60)。
* helpers/theme.js 会在运行时同步注入对应 rgb 版本。 */
/* 冷启动兜底色 = 站点默认预设(DEFAULT_PRESET_KEY = ocean 云平台 azure)。
* 与 presets.js 的 ocean.light 保持一致,避免首帧闪色。 */
--brand-primary: #1668dc; /* 云控制台主蓝(白字对比 5.18:1 过 AA,与 presets.js ocean 同步) */
--brand-primary-rgb: 22 104 220;
--brand-primary-hover: #0958d9; /* blue-6 */
--brand-primary-hover-rgb: 9 88 217;
--brand-primary-soft: rgba(22, 104, 220, 0.10);
/* 滚动条颜色(基于 brand-primary 派生半透明)
* 第一行 rgba 是 color-mix 不支持时的兜底(Chrome <111 / Firefox <113 / Safari <16.2),
* 第二行被现代浏览器识别,覆盖第一行。 */
--brand-scroll: rgba(22, 104, 220, 0.25);
--brand-scroll: color-mix(in srgb, var(--brand-primary) 25%, transparent);
--brand-scroll-hover: rgba(22, 104, 220, 0.45);
--brand-scroll-hover: color-mix(in srgb, var(--brand-primary) 45%, transparent);
/* === 签名渐变(核心识别) === */
--brand-gradient-from: #4096ff; /* blue-4 */
--brand-gradient-from-rgb: 64 150 255;
--brand-gradient-via: #1677ff; /* blue-5 */
--brand-gradient-via-rgb: 22 119 255;
--brand-gradient-to: #0958d9; /* blue-6 同阶收敛 */
--brand-gradient-to-rgb: 9 88 217;
/* === 页面背景晕染(大面积底色 / 光晕 blob) ===
* 与 brand-gradient-* 独立 —— 调它只影响页面背景大色块、动态光晕,
* 不影响按钮 / 气泡 / icon / 文字渐变(那些仍走 brand-gradient-*)。
* 只 2 stop(from/to),简单且全场所有页面统一使用。
* 取通透天蓝(云控制台轻盈氛围,与 presets.js ocean 同步)。 */
--bg-glow-from: #69b1ff; /* blue-3 通透云天 */
--bg-glow-from-rgb: 105 177 255;
--bg-glow-to: #91caff; /* blue-2 更轻盈 */
--bg-glow-to-rgb: 145 202 255;
/* === 强调色 === */
--accent-blue: #1677ff;
--accent-teal: #13c2c2; /* cyan 云科技点缀 */
--accent-emerald: #10b981;
/* === 表面层 ===
* 极淡冷蓝调(云平台质感):底色微偏蓝灰而非中性灰,白卡浮其上更通透。
* 所有页面 shell 用 bg-[var(--surface-bg-base)] 统一吃这个值。 */
--surface-bg-base: #f3f7fc; /* 冷调近白 */
--surface-card: #ffffff;
--surface-sidebar: #f6f9fd;
--surface-header: #ffffff;
/* === 文本与边框 === */
--text-primary: #1e293b;
--text-secondary: #475569;
/* 实底卡片方案靠 1px 边框分层(阴影极轻),比玻璃时代加深一档保证可辨 */
--border-subtle: rgba(15, 23, 42, 0.08);
/* === 动效 token(明暗共用)===
* 全站动效统一走这三档时长 + 一条 easing,禁止散落自定义 cubic-bezier。
* 只允许动 transform / opacity(不触发重排);入场动画只播一次。 */
--motion-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
--motion-fast: 150ms;
--motion-base: 240ms;
--motion-slow: 400ms;
/* === 海拔阴影体系(统一所有卡片/弹层/输入框的层次感) ===
* 极简但有层次:冷色调阴影(带一点蓝)比纯黑更通透高级。
* xs 描边级、sm 卡片静置、md 卡片 hover/弹层、lg 模态。 */
--elevation-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
--elevation-sm: 0 2px 8px -2px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
--elevation-md: 0 10px 28px -8px rgba(15, 23, 42, 0.12), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
--elevation-lg: 0 24px 56px -12px rgba(15, 23, 42, 0.18), 0 6px 16px -6px rgba(15, 23, 42, 0.10);
/* 品牌聚焦环 —— 输入框/可聚焦元素统一用它 */
--ring-brand: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 20%, transparent);
}
html.dark,
body[theme-mode='dark'] {
/* 冷启动兜底色 = ocean.dark(与 presets.js 同步)。
* primary 取 blue-5(#1677ff)——暗色实色按钮白字对比度 ~4.3 可读,不再用更浅的 blue-4。 */
--brand-primary: #1677ff; /* blue-5 */
--brand-primary-rgb: 22 119 255;
--brand-primary-hover: #4096ff; /* blue-4 */
--brand-primary-hover-rgb: 64 150 255;
--brand-primary-soft: rgba(22, 119, 255, 0.18);
--brand-scroll: rgba(22, 119, 255, 0.30);
--brand-scroll: color-mix(in srgb, var(--brand-primary) 30%, transparent);
--brand-scroll-hover: rgba(22, 119, 255, 0.50);
--brand-scroll-hover: color-mix(in srgb, var(--brand-primary) 50%, transparent);
--brand-gradient-from: #69b1ff; /* blue-3 */
--brand-gradient-from-rgb: 105 177 255;
--brand-gradient-via: #4096ff; /* blue-4 */
--brand-gradient-via-rgb: 64 150 255;
--brand-gradient-to: #1677ff; /* blue-5 */
--brand-gradient-to-rgb: 22 119 255;
/* 暗色页面背景晕染 —— 承接 ocean 暗色蓝阶,可单独调 */
--bg-glow-from: #4096ff;
--bg-glow-from-rgb: 64 150 255;
--bg-glow-to: #69b1ff;
--bg-glow-to-rgb: 105 177 255;
--accent-blue: #4096ff;
--accent-teal: #36cfc9; /* cyan-5 */
--accent-emerald: #34d399;
/* 暗色冷调底(微偏蓝黑,非纯中性黑),与浅色冷调呼应 */
--surface-bg-base: #0a0b10;
--surface-card: #16171d;
--surface-sidebar: #16171d;
--surface-header: #16171d;
--text-primary: #f4f4f5;
--text-secondary: #a1a1aa;
--border-subtle: rgba(255, 255, 255, 0.10);
/* 暗色海拔 —— 用更深的黑 + 略大扩散,暗背景上仍有层次 */
--elevation-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
--elevation-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.30);
--elevation-md: 0 10px 28px -8px rgba(0, 0, 0, 0.55), 0 2px 6px -2px rgba(0, 0, 0, 0.40);
--elevation-lg: 0 24px 56px -12px rgba(0, 0, 0, 0.65), 0 6px 16px -6px rgba(0, 0, 0, 0.45);
--ring-brand: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 32%, transparent);
}
/*
* 切换主题瞬间临时禁用所有 transition / animation,
* 避免大量带 transition 的组件同时渐变产生"卡 200ms"的观感。
* helpers/theme.js 在每次 applyTheme 时短暂挂载这个类。
*/
.theme-switching,
.theme-switching * {
transition: none !important;
animation-duration: 0s !important;
animation-delay: 0s !important;
}