mobile-green-palette-demo.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <title>移动端主题绿 · 色板挑选</title>
  7. <style>
  8. :root {
  9. --page-bg: #f4f6f5;
  10. --card: #fff;
  11. --ink: #1a2420;
  12. --muted: #5c6b64;
  13. --line: #e2e8e5;
  14. --current: #0a9f6d;
  15. }
  16. * { box-sizing: border-box; }
  17. body {
  18. margin: 0;
  19. font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
  20. background:
  21. radial-gradient(1200px 600px at 10% -10%, #d8f5e8 0%, transparent 55%),
  22. radial-gradient(900px 500px at 100% 0%, #e8f0ff 0%, transparent 50%),
  23. var(--page-bg);
  24. color: var(--ink);
  25. line-height: 1.45;
  26. }
  27. .wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
  28. header { margin-bottom: 28px; }
  29. header h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.02em; }
  30. header p { margin: 0; color: var(--muted); font-size: 14px; max-width: 720px; }
  31. .toolbar {
  32. display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  33. margin: 20px 0 8px; padding: 12px 14px; background: rgba(255,255,255,.75);
  34. border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(8px);
  35. }
  36. .toolbar label { font-size: 13px; color: var(--muted); }
  37. .toolbar select, .toolbar input[type="search"] {
  38. height: 36px; border: 1px solid var(--line); border-radius: 8px;
  39. padding: 0 10px; background: #fff; font: inherit; color: var(--ink);
  40. }
  41. .toolbar input[type="search"] { min-width: 200px; }
  42. .chip {
  43. display: inline-flex; align-items: center; gap: 6px;
  44. padding: 4px 10px; border-radius: 999px; font-size: 12px;
  45. background: #ecfdf5; color: #087f57; border: 1px solid #a7f3d0;
  46. }
  47. .chip .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--current); }
  48. .hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
  49. .grid {
  50. display: grid;
  51. grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  52. gap: 16px;
  53. margin-top: 18px;
  54. }
  55. .card {
  56. background: var(--card);
  57. border: 1px solid var(--line);
  58. border-radius: 16px;
  59. overflow: hidden;
  60. box-shadow: 0 8px 24px rgba(20, 40, 30, .04);
  61. transition: border-color .15s, box-shadow .15s, transform .15s;
  62. cursor: pointer;
  63. }
  64. .card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(20,40,30,.08); }
  65. .card.is-current { border-color: #94a3b8; outline: 2px dashed #94a3b8; outline-offset: -2px; }
  66. .card.is-selected {
  67. border-color: var(--p, #0a9f6d);
  68. box-shadow: 0 0 0 3px color-mix(in srgb, var(--p) 28%, transparent);
  69. }
  70. .card-top {
  71. display: grid;
  72. grid-template-columns: 1.2fr .8fr .7fr;
  73. height: 72px;
  74. }
  75. .swatch { display: flex; align-items: flex-end; padding: 8px; color: #fff; font-size: 11px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
  76. .swatch.soft { color: #1f2a26; text-shadow: none; }
  77. .body { padding: 14px 14px 16px; }
  78. .title-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 6px; }
  79. .title { font-size: 16px; font-weight: 650; margin: 0; }
  80. .tag {
  81. font-size: 11px; padding: 2px 8px; border-radius: 999px;
  82. background: #f1f5f4; color: var(--muted); white-space: nowrap;
  83. }
  84. .tag.hot { background: #fff7ed; color: #c2410c; }
  85. .tag.cool { background: #eff6ff; color: #1d4ed8; }
  86. .tag.fresh { background: #ecfdf5; color: #047857; }
  87. .desc { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); min-height: 36px; }
  88. .tokens { display: grid; gap: 6px; margin-bottom: 12px; }
  89. .token {
  90. display: flex; align-items: center; justify-content: space-between; gap: 8px;
  91. font-size: 12px; padding: 6px 8px; border-radius: 8px; background: #f8faf9;
  92. border: 1px solid #edf2ef;
  93. }
  94. .token code {
  95. font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  96. font-size: 12px; letter-spacing: .02em;
  97. }
  98. .token button {
  99. border: 0; background: transparent; color: var(--muted); cursor: pointer;
  100. font-size: 11px; padding: 2px 6px; border-radius: 4px;
  101. }
  102. .token button:hover { background: #e8eee9; color: var(--ink); }
  103. .preview {
  104. border: 1px solid var(--line);
  105. border-radius: 12px;
  106. overflow: hidden;
  107. background: #f7faf8;
  108. }
  109. .nav {
  110. height: 40px; display: flex; align-items: center; justify-content: center;
  111. color: #fff; font-size: 13px; font-weight: 600;
  112. background: linear-gradient(135deg, var(--p), var(--d));
  113. }
  114. .preview-body { padding: 12px; display: grid; gap: 8px; }
  115. .pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
  116. .pill {
  117. font-size: 11px; padding: 4px 8px; border-radius: 999px;
  118. background: var(--s); color: var(--d); border: 1px solid color-mix(in srgb, var(--p) 25%, white);
  119. }
  120. .btn {
  121. height: 36px; border: 0; border-radius: 999px; color: #fff;
  122. background: var(--p); font-size: 13px; font-weight: 600;
  123. display: flex; align-items: center; justify-content: center;
  124. }
  125. .btn.outline {
  126. background: transparent; color: var(--p);
  127. border: 1.5px solid var(--p);
  128. }
  129. .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  130. .soft-block {
  131. padding: 10px; border-radius: 10px; background: var(--s);
  132. color: var(--d); font-size: 12px;
  133. }
  134. .footer-bar {
  135. position: sticky; bottom: 12px; margin-top: 24px;
  136. background: rgba(255,255,255,.92); border: 1px solid var(--line);
  137. border-radius: 14px; padding: 12px 14px;
  138. display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  139. backdrop-filter: blur(10px);
  140. box-shadow: 0 10px 30px rgba(0,0,0,.08);
  141. }
  142. .picked { display: flex; align-items: center; gap: 10px; font-size: 13px; }
  143. .picked .big {
  144. width: 36px; height: 36px; border-radius: 10px;
  145. border: 1px solid rgba(0,0,0,.08);
  146. background: linear-gradient(135deg, var(--fp, #0a9f6d), var(--fd, #087f57));
  147. }
  148. .picked strong { display: block; font-size: 14px; }
  149. .picked span { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
  150. .actions { display: flex; gap: 8px; flex-wrap: wrap; }
  151. .actions button {
  152. height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  153. background: #fff; cursor: pointer; font: inherit; font-size: 13px;
  154. }
  155. .actions button.primary {
  156. background: var(--fp, #0a9f6d); border-color: transparent; color: #fff; font-weight: 600;
  157. }
  158. .toast {
  159. position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(12px);
  160. background: #1f2a26; color: #fff; padding: 8px 14px; border-radius: 999px;
  161. font-size: 13px; opacity: 0; pointer-events: none; transition: .2s;
  162. z-index: 20;
  163. }
  164. .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  165. .section-title {
  166. margin: 28px 0 10px; font-size: 14px; color: var(--muted);
  167. display: flex; align-items: center; gap: 8px;
  168. }
  169. .section-title::after {
  170. content: ""; flex: 1; height: 1px; background: var(--line);
  171. }
  172. @media (max-width: 480px) {
  173. .card-top { height: 56px; }
  174. .toolbar input[type="search"] { min-width: 0; width: 100%; }
  175. }
  176. </style>
  177. </head>
  178. <body>
  179. <div class="wrap">
  180. <header>
  181. <h1>移动端主题绿 · 色板挑选</h1>
  182. <p>
  183. 当前工程(mobile-h5 / mobile-oa-h5)主色为三墙绿
  184. <span class="chip"><i class="sw"></i>#0a9f6d / #087f57</span>。
  185. 下方每组含主色 / 深绿 / 浅绿底,并有导航、按钮、标签预览。点击卡片选中,点色值可复制。
  186. </p>
  187. <div class="toolbar">
  188. <label>筛选</label>
  189. <select id="filter">
  190. <option value="all">全部</option>
  191. <option value="current">当前</option>
  192. <option value="teal">青绿 / Teal</option>
  193. <option value="jade">翠绿 / Jade</option>
  194. <option value="forest">森绿 / Forest</option>
  195. <option value="mint">薄荷绿 / Mint</option>
  196. <option value="olive">橄榄 / Olive</option>
  197. <option value="deep">更深更沉</option>
  198. <option value="bright">更亮更鲜</option>
  199. </select>
  200. <input id="q" type="search" placeholder="搜名称或色值,如 jade / 0d9488" />
  201. <span class="hint">建议:企业 OA 偏稳重选「森绿 / 青绿」;偏年轻活力选「翠绿 / 亮绿」。</span>
  202. </div>
  203. </header>
  204. <div id="sections"></div>
  205. <div class="footer-bar" id="footer">
  206. <div class="picked">
  207. <div class="big" id="pickedSwatch"></div>
  208. <div>
  209. <strong id="pickedName">未选择</strong>
  210. <span id="pickedHex">点击上方色卡挑选</span>
  211. </div>
  212. </div>
  213. <div class="actions">
  214. <button type="button" id="copyCss">复制 CSS Token</button>
  215. <button type="button" class="primary" id="copyAll">复制主色三件套</button>
  216. </div>
  217. </div>
  218. </div>
  219. <div class="toast" id="toast">已复制</div>
  220. <script>
  221. /**
  222. * 每组:id, name, group, vibe(tag), desc, primary, dark, soft, tags[]
  223. * soft 为浅底;dark 用于渐变末端与强调字色
  224. */
  225. const PALETTES = [
  226. {
  227. id: 'current',
  228. name: '当前 · 三墙绿',
  229. group: 'current',
  230. vibe: '当前',
  231. tagClass: '',
  232. desc: '现网 mobile-h5 / mobile-oa-h5 主题。稳、偏深,和三墙小程序一致。',
  233. primary: '#0a9f6d',
  234. dark: '#087f57',
  235. soft: '#e9f9f2',
  236. tags: ['current', 'jade', 'deep']
  237. },
  238. {
  239. id: 'admin-mint',
  240. name: '管理端 · Fresh Mint',
  241. group: 'mint',
  242. vibe: '对照',
  243. tagClass: 'cool',
  244. desc: 'web-admin 主色,偏亮薄荷绿。移动端规范一般不混用,仅作对照。',
  245. primary: '#10b981',
  246. dark: '#059669',
  247. soft: '#ecfdf5',
  248. tags: ['mint', 'bright']
  249. },
  250. // —— 青绿 Teal ——
  251. {
  252. id: 'teal-01',
  253. name: '海湾青绿',
  254. group: 'teal',
  255. vibe: '青绿',
  256. tagClass: 'cool',
  257. desc: '偏蓝的青绿,科技感强,适合工具型 OA,和「蔬菜绿」拉开距离。',
  258. primary: '#0d9488',
  259. dark: '#0f766e',
  260. soft: '#f0fdfa',
  261. tags: ['teal', 'cool']
  262. },
  263. {
  264. id: 'teal-02',
  265. name: '深海青',
  266. group: 'teal',
  267. vibe: '青绿',
  268. tagClass: 'cool',
  269. desc: '更深更沉的 teal,导航栏会更稳重,按钮对比度高。',
  270. primary: '#0f766e',
  271. dark: '#115e59',
  272. soft: '#ccfbf1',
  273. tags: ['teal', 'deep']
  274. },
  275. {
  276. id: 'teal-03',
  277. name: '青瓷',
  278. group: 'teal',
  279. vibe: '青绿',
  280. tagClass: 'cool',
  281. desc: '略灰的青瓷感,不抢眼,适合长时间办公阅读。',
  282. primary: '#14b8a6',
  283. dark: '#0d9488',
  284. soft: '#f0fdfa',
  285. tags: ['teal', 'bright']
  286. },
  287. {
  288. id: 'teal-04',
  289. name: '蓝绿松',
  290. group: 'teal',
  291. vibe: '青绿',
  292. tagClass: 'cool',
  293. desc: '略偏蓝,接近 Notion/Linear 一类产品的冷静绿。',
  294. primary: '#2dd4bf',
  295. dark: '#14b8a6',
  296. soft: '#f0fdfa',
  297. tags: ['teal', 'bright']
  298. },
  299. // —— 翠绿 Jade ——
  300. {
  301. id: 'jade-01',
  302. name: '玉翠',
  303. group: 'jade',
  304. vibe: '翠绿',
  305. tagClass: 'fresh',
  306. desc: '比当前色更亮一点,仍是「正绿」,亲和力更好。',
  307. primary: '#059669',
  308. dark: '#047857',
  309. soft: '#ecfdf5',
  310. tags: ['jade', 'bright']
  311. },
  312. {
  313. id: 'jade-02',
  314. name: '翡冷翠',
  315. group: 'jade',
  316. vibe: '翠绿',
  317. tagClass: 'fresh',
  318. desc: '经典 emerald,比 #0a9f6d 略深、更「正」。',
  319. primary: '#047857',
  320. dark: '#065f46',
  321. soft: '#d1fae5',
  322. tags: ['jade', 'deep']
  323. },
  324. {
  325. id: 'jade-03',
  326. name: '青葱',
  327. group: 'jade',
  328. vibe: '翠绿',
  329. tagClass: 'fresh',
  330. desc: '偏黄的鲜绿,更有「新鲜」感,适合生鲜/农业场景。',
  331. primary: '#16a34a',
  332. dark: '#15803d',
  333. soft: '#f0fdf4',
  334. tags: ['jade', 'bright']
  335. },
  336. {
  337. id: 'jade-04',
  338. name: '竹青',
  339. group: 'jade',
  340. vibe: '翠绿',
  341. tagClass: 'fresh',
  342. desc: '中等饱和竹青,介于当前色与亮绿之间。',
  343. primary: '#22c55e',
  344. dark: '#16a34a',
  345. soft: '#f0fdf4',
  346. tags: ['jade', 'bright']
  347. },
  348. {
  349. id: 'jade-05',
  350. name: '叶绿',
  351. group: 'jade',
  352. vibe: '翠绿',
  353. tagClass: 'fresh',
  354. desc: '略偏黄绿,自然、户外感,和「医疗青绿」不同。',
  355. primary: '#4ade80',
  356. dark: '#22c55e',
  357. soft: '#f0fdf4',
  358. tags: ['jade', 'bright']
  359. },
  360. {
  361. id: 'jade-06',
  362. name: '苔藓亮',
  363. group: 'jade',
  364. vibe: '翠绿',
  365. tagClass: 'fresh',
  366. desc: '饱和度高,主按钮很跳;慎用于大面积顶栏。',
  367. primary: '#12b76a',
  368. dark: '#039855',
  369. soft: '#e8faf0',
  370. tags: ['jade', 'bright']
  371. },
  372. // —— 森绿 Forest ——
  373. {
  374. id: 'forest-01',
  375. name: '松针',
  376. group: 'forest',
  377. vibe: '森绿',
  378. tagClass: 'hot',
  379. desc: '深森绿,企业感强,顶栏很稳;浅底用浅绿提亮。',
  380. primary: '#166534',
  381. dark: '#14532d',
  382. soft: '#dcfce7',
  383. tags: ['forest', 'deep']
  384. },
  385. {
  386. id: 'forest-02',
  387. name: '杉木',
  388. group: 'forest',
  389. vibe: '森绿',
  390. tagClass: '',
  391. desc: '比松针稍亮,仍属「深绿色」一档,适合严肃审批流。',
  392. primary: '#15803d',
  393. dark: '#166534',
  394. soft: '#dcfce7',
  395. tags: ['forest', 'deep']
  396. },
  397. {
  398. id: 'forest-03',
  399. name: '墨绿',
  400. group: 'forest',
  401. vibe: '森绿',
  402. tagClass: '',
  403. desc: '偏黑的墨绿,极稳重;移动端大面积使用需注意对比度。',
  404. primary: '#14532d',
  405. dark: '#052e16',
  406. soft: '#bbf7d0',
  407. tags: ['forest', 'deep']
  408. },
  409. {
  410. id: 'forest-04',
  411. name: '柏绿',
  412. group: 'forest',
  413. vibe: '森绿',
  414. tagClass: '',
  415. desc: '略灰的森绿,不那么「鲜」,更像线下物料印刷绿。',
  416. primary: '#3f6212',
  417. dark: '#365314',
  418. soft: '#ecfccb',
  419. tags: ['forest', 'olive', 'deep']
  420. },
  421. // —— 薄荷绿 Mint ——
  422. {
  423. id: 'mint-01',
  424. name: '霜薄荷',
  425. group: 'mint',
  426. vibe: '薄荷',
  427. tagClass: 'fresh',
  428. desc: '浅亮薄荷,年轻清爽;顶栏偏浅时需配深色字。',
  429. primary: '#34d399',
  430. dark: '#10b981',
  431. soft: '#ecfdf5',
  432. tags: ['mint', 'bright']
  433. },
  434. {
  435. id: 'mint-02',
  436. name: '汽水绿',
  437. group: 'mint',
  438. vibe: '薄荷',
  439. tagClass: 'fresh',
  440. desc: '高亮偏青,偏消费级 App;B 端审批可能略跳。',
  441. primary: '#2dd4bf',
  442. dark: '#14b8a6',
  443. soft: '#ccfbf1',
  444. tags: ['mint', 'teal', 'bright']
  445. },
  446. {
  447. id: 'mint-03',
  448. name: '春芽',
  449. group: 'mint',
  450. vibe: '薄荷',
  451. tagClass: 'fresh',
  452. desc: '黄调薄荷,春天感强,和深色字搭配时注意对比。',
  453. primary: '#4ade80',
  454. dark: '#22c55e',
  455. soft: '#f0fdf4',
  456. tags: ['mint', 'bright']
  457. },
  458. {
  459. id: 'mint-04',
  460. name: '淡青',
  461. group: 'mint',
  462. vibe: '薄荷',
  463. tagClass: 'cool',
  464. desc: '低饱和淡青,偏「健康医疗」气质。',
  465. primary: '#5eead4',
  466. dark: '#2dd4bf',
  467. soft: '#f0fdfa',
  468. tags: ['mint', 'teal', 'bright']
  469. },
  470. // —— 橄榄 Olive ——
  471. {
  472. id: 'olive-01',
  473. name: '橄榄绿',
  474. group: 'olive',
  475. vibe: '橄榄',
  476. tagClass: 'hot',
  477. desc: '军绿感克制,独特且不俗;和常见「翠绿」明显区分。',
  478. primary: '#65a30d',
  479. dark: '#4d7c0f',
  480. soft: '#f7fee7',
  481. tags: ['olive', 'bright']
  482. },
  483. {
  484. id: 'olive-02',
  485. name: '苔绿',
  486. group: 'olive',
  487. vibe: '橄榄',
  488. tagClass: 'hot',
  489. desc: '偏黄灰的苔藓绿,自然、沉静。',
  490. primary: '#4d7c0f',
  491. dark: '#3f6212',
  492. soft: '#ecfccb',
  493. tags: ['olive', 'deep']
  494. },
  495. {
  496. id: 'olive-03',
  497. name: '卡其绿',
  498. group: 'olive',
  499. vibe: '橄榄',
  500. tagClass: '',
  501. desc: '低饱和卡其绿,极克制;主按钮可再略提饱和。',
  502. primary: '#84cc16',
  503. dark: '#65a30d',
  504. soft: '#f7fee7',
  505. tags: ['olive', 'bright']
  506. },
  507. {
  508. id: 'olive-04',
  509. name: '茶绿',
  510. group: 'olive',
  511. vibe: '橄榄',
  512. tagClass: '',
  513. desc: '略灰茶绿,偏传统国风,适合政务/传统企业审美。',
  514. primary: '#6b8e23',
  515. dark: '#556b2f',
  516. soft: '#f2f7e8',
  517. tags: ['olive', 'deep']
  518. },
  519. // —— 更多变体 / 品牌向 ——
  520. {
  521. id: 'brand-01',
  522. name: '微信绿邻域',
  523. group: 'jade',
  524. vibe: '对照',
  525. tagClass: 'hot',
  526. desc: '接近微信绿 #07c160,用户熟悉;品牌辨识度一般。',
  527. primary: '#07c160',
  528. dark: '#06ad56',
  529. soft: '#e8faf0',
  530. tags: ['jade', 'bright']
  531. },
  532. {
  533. id: 'brand-02',
  534. name: '钉钉青邻域',
  535. group: 'teal',
  536. vibe: '对照',
  537. tagClass: 'cool',
  538. desc: '偏钉钉青蓝,协作工具感;和生鲜绿差异大。',
  539. primary: '#0089ff',
  540. dark: '#0066cc',
  541. soft: '#e8f3ff',
  542. tags: ['teal', 'bright']
  543. },
  544. {
  545. id: 'brand-03',
  546. name: '飞书绿邻域',
  547. group: 'teal',
  548. vibe: '对照',
  549. tagClass: 'cool',
  550. desc: '偏青绿协作风,冷静专业。',
  551. primary: '#00d6b9',
  552. dark: '#00b5a0',
  553. soft: '#e6fffa',
  554. tags: ['teal', 'mint', 'bright']
  555. },
  556. {
  557. id: 'brand-04',
  558. name: '深翡翠',
  559. group: 'jade',
  560. vibe: '推荐',
  561. tagClass: 'fresh',
  562. desc: '比当前略深、略正,仍是绿系;换主题时改动感适中。',
  563. primary: '#0f9f6e',
  564. dark: '#0b7f57',
  565. soft: '#e6f7f0',
  566. tags: ['jade', 'deep']
  567. },
  568. {
  569. id: 'brand-05',
  570. name: '青玉',
  571. group: 'teal',
  572. vibe: '推荐',
  573. tagClass: 'cool',
  574. desc: '主色略偏青,和当前绿有区分又不跳戏。',
  575. primary: '#0b9e8a',
  576. dark: '#087f6f',
  577. soft: '#e6f8f5',
  578. tags: ['teal']
  579. },
  580. {
  581. id: 'brand-06',
  582. name: '森氧',
  583. group: 'forest',
  584. vibe: '推荐',
  585. tagClass: 'fresh',
  586. desc: '更深一档的品牌绿,顶栏更「重」,按钮仍够绿。',
  587. primary: '#1b7a4e',
  588. dark: '#145c3b',
  589. soft: '#e4f4ec',
  590. tags: ['forest', 'deep']
  591. },
  592. {
  593. id: 'brand-07',
  594. name: '晴绿',
  595. group: 'jade',
  596. vibe: '推荐',
  597. tagClass: 'fresh',
  598. desc: '比当前更亮更干净,适合想「提亮一档」但不换色相。',
  599. primary: '#12a875',
  600. dark: '#0d8a5f',
  601. soft: '#e8f8f1',
  602. tags: ['jade', 'bright']
  603. },
  604. {
  605. id: 'brand-08',
  606. name: '雾绿',
  607. group: 'olive',
  608. vibe: '克制',
  609. tagClass: '',
  610. desc: '降饱和雾绿,高级感;大按钮可再加点饱和。',
  611. primary: '#5b8a72',
  612. dark: '#476e5a',
  613. soft: '#eef4f0',
  614. tags: ['olive', 'deep']
  615. },
  616. {
  617. id: 'brand-09',
  618. name: '孔雀石',
  619. group: 'teal',
  620. vibe: '个性',
  621. tagClass: 'cool',
  622. desc: '偏蓝绿宝石感,辨识度高,适合想和「菜市场绿」拉开。',
  623. primary: '#0e9f8c',
  624. dark: '#0b7d6e',
  625. soft: '#e5f7f4',
  626. tags: ['teal']
  627. },
  628. {
  629. id: 'brand-10',
  630. name: '荧光绿(慎用)',
  631. group: 'mint',
  632. vibe: '个性',
  633. tagClass: 'hot',
  634. desc: '极亮,仅适合强调态;不建议做整站主色。',
  635. primary: '#39ff14',
  636. dark: '#22c55e',
  637. soft: '#f0ffe8',
  638. tags: ['mint', 'bright']
  639. },
  640. {
  641. id: 'brand-11',
  642. name: '北欧松',
  643. group: 'forest',
  644. vibe: '克制',
  645. tagClass: '',
  646. desc: '灰调森绿,北欧家具感,B 端偏设计感。',
  647. primary: '#2f6b4f',
  648. dark: '#24543e',
  649. soft: '#e8f1ec',
  650. tags: ['forest', 'deep']
  651. },
  652. {
  653. id: 'brand-12',
  654. name: '青柠',
  655. group: 'olive',
  656. vibe: '活力',
  657. tagClass: 'hot',
  658. desc: '黄绿偏青柠,活泼;审批严肃页可能略轻松。',
  659. primary: '#84cc16',
  660. dark: '#4d7c0f',
  661. soft: '#f7fee7',
  662. tags: ['olive', 'bright']
  663. }
  664. ];
  665. const GROUP_LABEL = {
  666. current: '当前与对照',
  667. teal: '青绿 / Teal',
  668. jade: '翠绿 / Jade',
  669. forest: '森绿 / Forest',
  670. mint: '薄荷绿 / Mint',
  671. olive: '橄榄 / Olive'
  672. };
  673. let selected = null;
  674. function toast(msg) {
  675. const el = document.getElementById('toast');
  676. el.textContent = msg;
  677. el.classList.add('show');
  678. clearTimeout(toast._t);
  679. toast._t = setTimeout(() => el.classList.remove('show'), 1400);
  680. }
  681. async function copyText(text) {
  682. try {
  683. await navigator.clipboard.writeText(text);
  684. toast('已复制:' + text);
  685. } catch {
  686. const ta = document.createElement('textarea');
  687. ta.value = text;
  688. document.body.appendChild(ta);
  689. ta.select();
  690. document.execCommand('copy');
  691. document.body.removeChild(ta);
  692. toast('已复制:' + text);
  693. }
  694. }
  695. function matchesFilter(p, filter, q) {
  696. if (filter !== 'all') {
  697. if (filter === 'current') {
  698. if (p.id !== 'current' && p.id !== 'admin-mint') return false;
  699. } else if (!p.tags.includes(filter) && p.group !== filter) {
  700. return false;
  701. }
  702. }
  703. if (!q) return true;
  704. const hay = (p.name + p.desc + p.primary + p.dark + p.soft + p.id + p.vibe).toLowerCase();
  705. return hay.includes(q);
  706. }
  707. function render() {
  708. const filter = document.getElementById('filter').value;
  709. const q = document.getElementById('q').value.trim().toLowerCase();
  710. const root = document.getElementById('sections');
  711. root.innerHTML = '';
  712. const list = PALETTES.filter(p => matchesFilter(p, filter, q));
  713. const byGroup = {};
  714. for (const p of list) {
  715. (byGroup[p.group] ||= []).push(p);
  716. }
  717. const order = ['current', 'jade', 'teal', 'forest', 'mint', 'olive'];
  718. for (const g of order) {
  719. const items = byGroup[g];
  720. if (!items || !items.length) continue;
  721. const title = document.createElement('div');
  722. title.className = 'section-title';
  723. title.textContent = GROUP_LABEL[g] || g;
  724. root.appendChild(title);
  725. const grid = document.createElement('div');
  726. grid.className = 'grid';
  727. for (const p of items) {
  728. const card = document.createElement('article');
  729. card.className = 'card' + (p.id === 'current' ? ' is-current' : '') + (selected?.id === p.id ? ' is-selected' : '');
  730. card.style.setProperty('--p', p.primary);
  731. card.style.setProperty('--d', p.dark);
  732. card.style.setProperty('--s', p.soft);
  733. card.innerHTML = `
  734. <div class="card-top">
  735. <div class="swatch" style="background:${p.primary}">主色</div>
  736. <div class="swatch" style="background:${p.dark}">深绿</div>
  737. <div class="swatch soft" style="background:${p.soft}">浅绿底</div>
  738. </div>
  739. <div class="body">
  740. <div class="title-row">
  741. <h3 class="title">${p.name}</h3>
  742. <span class="tag ${p.tagClass || ''}">${p.vibe}</span>
  743. </div>
  744. <p class="desc">${p.desc}</p>
  745. <div class="tokens">
  746. <div class="token"><span>primary</span><span><code data-hex="${p.primary}">${p.primary}</code> <button type="button" data-copy="${p.primary}">复制</button></span></div>
  747. <div class="token"><span>dark</span><span><code data-hex="${p.dark}">${p.dark}</code> <button type="button" data-copy="${p.dark}">复制</button></span></div>
  748. <div class="token"><span>soft</span><span><code data-hex="${p.soft}">${p.soft}</code> <button type="button" data-copy="${p.soft}">复制</button></span></div>
  749. </div>
  750. <div class="preview">
  751. <div class="nav">发起审批</div>
  752. <div class="preview-body">
  753. <div class="pill-row">
  754. <span class="pill">进行中</span>
  755. <span class="pill">已通过</span>
  756. </div>
  757. <div class="soft-block">浅绿底提示条 · 待办 3 项</div>
  758. <div class="btn-row">
  759. <div class="btn">提交</div>
  760. <div class="btn outline">取消</div>
  761. </div>
  762. </div>
  763. </div>
  764. </div>
  765. `;
  766. card.addEventListener('click', (e) => {
  767. if (e.target.closest('[data-copy]')) return;
  768. selectPalette(p);
  769. render();
  770. });
  771. card.querySelectorAll('[data-copy]').forEach(btn => {
  772. btn.addEventListener('click', (e) => {
  773. e.stopPropagation();
  774. copyText(btn.getAttribute('data-copy'));
  775. });
  776. });
  777. grid.appendChild(card);
  778. }
  779. root.appendChild(grid);
  780. }
  781. if (!list.length) {
  782. root.innerHTML = '<p class="hint">没有匹配的色板,试试换个关键词。</p>';
  783. }
  784. }
  785. function selectPalette(p) {
  786. selected = p;
  787. document.getElementById('pickedName').textContent = p.name;
  788. document.getElementById('pickedHex').textContent =
  789. `${p.primary} / ${p.dark} / ${p.soft}`;
  790. const bar = document.getElementById('footer');
  791. bar.style.setProperty('--fp', p.primary);
  792. bar.style.setProperty('--fd', p.dark);
  793. document.getElementById('pickedSwatch').style.background =
  794. `linear-gradient(135deg, ${p.primary}, ${p.dark})`;
  795. }
  796. document.getElementById('filter').addEventListener('change', render);
  797. document.getElementById('q').addEventListener('input', render);
  798. document.getElementById('copyAll').addEventListener('click', () => {
  799. if (!selected) { toast('请先点选一张色卡'); return; }
  800. copyText(`${selected.primary}, ${selected.dark}, ${selected.soft}`);
  801. });
  802. document.getElementById('copyCss').addEventListener('click', () => {
  803. if (!selected) { toast('请先点选一张色卡'); return; }
  804. const css = `/* ${selected.name} */
  805. --brand-green: ${selected.primary};
  806. --brand-green-dark: ${selected.dark};
  807. --brand-green-soft: ${selected.soft};
  808. --van-primary-color: ${selected.primary};`;
  809. copyText(css);
  810. });
  811. // 默认选中当前
  812. selectPalette(PALETTES[0]);
  813. render();
  814. </script>
  815. </body>
  816. </html>