跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

appearance-presets.mjs

694 行 · 16.7 KB历史下载
1// Cage adaptations of these palettes; no third-party theme files are loaded at runtime.
2// VS Code: https://github.com/microsoft/vscode/tree/main/extensions/theme-defaults/themes
3// Typora: https://github.com/typora/typora-default-themes
4// Nord: https://www.nordtheme.com/docs/colors-and-palettes/
5// Dracula: https://draculatheme.com/contribute
6// Color Universal Design: https://jfly.uni-koeln.de/color/
7const light = (accent, surface, ink, colors = {}, terminal = {}) => ({
8 accent,
9 surface,
10 ink,
11 contrast: 45,
12 colors,
13 terminal,
14});
15const dark = (accent, surface, ink, colors = {}, terminal = {}) => ({
16 accent,
17 surface,
18 ink,
19 contrast: 60,
20 colors,
21 terminal,
22});
23
24export const themeCatalog = [
25 {
26 id: "codex",
27 name: "Codex",
28 group: "经典",
29 description: "中性背景与蓝色强调,保持 Cage 的默认外观。",
30 light: light("#339cff", "#ffffff", "#1a1c1f"),
31 dark: dark("#339cff", "#181818", "#ffffff"),
32 },
33 {
34 id: "solarized",
35 name: "Solarized",
36 group: "经典",
37 description: "暖米白与深青底色,使用低饱和度的阅读配色。",
38 light: light("#b58900", "#fdf6e3", "#657b83"),
39 dark: dark("#b58900", "#002b36", "#93a1a1"),
40 },
41 {
42 id: "ayu",
43 name: "Ayu",
44 group: "经典",
45 description: "深蓝灰背景,搭配温暖的金色强调。",
46 dark: dark("#e6b450", "#10141c", "#bfbdb6"),
47 },
48 {
49 id: "vscode-modern",
50 name: "VS Code Modern",
51 group: "编辑器",
52 description: "参考 VS Code Modern,区分工作区、侧栏和输入框的层级。",
53 light: light(
54 "#005fb8",
55 "#ffffff",
56 "#3b3b3b",
57 {
58 chrome: "#f8f8f8",
59 sidebar: "#f8f8f8",
60 toolbar: "#f8f8f8",
61 line: "#cecece",
62 strong: "#1f1f1f",
63 muted: "#616161",
64 hover: "#f2f2f2",
65 selected: "#e8e8e8",
66 selection: "#add6ff",
67 button: "#005fb8",
68 buttonInk: "#ffffff",
69 },
70 {
71 red: "#a31515",
72 green: "#176b23",
73 yellow: "#795e26",
74 blue: "#005fb8",
75 magenta: "#813f9c",
76 cyan: "#006b70",
77 brightBlack: "#616161",
78 },
79 ),
80 dark: dark(
81 "#0078d4",
82 "#1f1f1f",
83 "#cccccc",
84 {
85 chrome: "#181818",
86 sidebar: "#181818",
87 toolbar: "#181818",
88 input: "#313131",
89 line: "#3c3c3c",
90 strong: "#ffffff",
91 muted: "#9d9d9d",
92 hover: "#2b2b2b",
93 selected: "#353535",
94 selection: "#264f78",
95 button: "#0078d4",
96 buttonInk: "#ffffff",
97 link: "#4daafc",
98 },
99 {
100 red: "#f48771",
101 green: "#89d185",
102 yellow: "#dcdcaa",
103 blue: "#4daafc",
104 magenta: "#c586c0",
105 cyan: "#4ec9b0",
106 white: "#cccccc",
107 brightBlack: "#9d9d9d",
108 },
109 ),
110 },
111 {
112 id: "vscode-classic",
113 name: "VS Code Classic",
114 group: "编辑器",
115 description: "参考经典 Light+ / Dark+,蓝色强调与清楚的面板分区。",
116 light: light(
117 "#0066b8",
118 "#ffffff",
119 "#202020",
120 {
121 chrome: "#f3f3f3",
122 sidebar: "#f3f3f3",
123 toolbar: "#f3f3f3",
124 line: "#b8b8b8",
125 muted: "#5a5a5a",
126 selected: "#d6ebff",
127 selection: "#add6ff",
128 button: "#0066b8",
129 buttonInk: "#ffffff",
130 },
131 {
132 red: "#a31515",
133 green: "#176b23",
134 yellow: "#795e26",
135 blue: "#0451a5",
136 magenta: "#813f9c",
137 cyan: "#006b70",
138 },
139 ),
140 dark: dark(
141 "#569cd6",
142 "#1e1e1e",
143 "#d4d4d4",
144 {
145 chrome: "#252526",
146 sidebar: "#252526",
147 toolbar: "#252526",
148 line: "#555555",
149 muted: "#a0a0a0",
150 selected: "#37373d",
151 selection: "#264f78",
152 button: "#0e639c",
153 buttonInk: "#ffffff",
154 },
155 {
156 red: "#f48771",
157 green: "#b5cea8",
158 yellow: "#dcdcaa",
159 blue: "#569cd6",
160 magenta: "#c586c0",
161 cyan: "#4ec9b0",
162 white: "#d4d4d4",
163 },
164 ),
165 },
166 {
167 id: "github",
168 name: "GitHub",
169 group: "编辑器",
170 description: "清爽的蓝灰配色,提供白底与深色两套搭配。",
171 light: light(
172 "#0969da",
173 "#ffffff",
174 "#24292f",
175 {
176 chrome: "#f6f8fa",
177 sidebar: "#f6f8fa",
178 toolbar: "#f6f8fa",
179 line: "#d0d7de",
180 muted: "#57606a",
181 selected: "#ddf4ff",
182 button: "#1a7f37",
183 buttonInk: "#ffffff",
184 success: "#1a7f37",
185 danger: "#cf222e",
186 warning: "#9a6700",
187 },
188 {
189 red: "#cf222e",
190 green: "#1a7f37",
191 yellow: "#9a6700",
192 blue: "#0969da",
193 magenta: "#8250df",
194 cyan: "#1b7c83",
195 white: "#57606a",
196 },
197 ),
198 dark: dark(
199 "#58a6ff",
200 "#0d1117",
201 "#e6edf3",
202 {
203 chrome: "#161b22",
204 sidebar: "#161b22",
205 toolbar: "#161b22",
206 line: "#484f58",
207 muted: "#9da7b3",
208 selected: "#253a52",
209 button: "#238636",
210 buttonInk: "#ffffff",
211 success: "#7ee787",
212 danger: "#ff7b72",
213 warning: "#e3b341",
214 },
215 {
216 red: "#ff7b72",
217 green: "#7ee787",
218 yellow: "#e3b341",
219 blue: "#79c0ff",
220 magenta: "#d2a8ff",
221 cyan: "#a5d6ff",
222 white: "#e6edf3",
223 brightBlack: "#9da7b3",
224 },
225 ),
226 },
227 {
228 id: "nord",
229 name: "Nord",
230 group: "编辑器",
231 description: "冷调蓝灰与冰蓝强调,参考 Nord 的极地色板。",
232 light: light(
233 "#375f88",
234 "#eceff4",
235 "#2e3440",
236 {
237 chrome: "#e5e9f0",
238 sidebar: "#e5e9f0",
239 toolbar: "#e5e9f0",
240 line: "#9aa7b8",
241 muted: "#4c566a",
242 selected: "#cbd9e8",
243 button: "#375f88",
244 buttonInk: "#ffffff",
245 },
246 {
247 red: "#963f4c",
248 green: "#466637",
249 yellow: "#795d22",
250 blue: "#375f88",
251 magenta: "#80567b",
252 cyan: "#346b70",
253 },
254 ),
255 dark: dark(
256 "#88c0d0",
257 "#2e3440",
258 "#eceff4",
259 {
260 chrome: "#3b4252",
261 sidebar: "#3b4252",
262 toolbar: "#3b4252",
263 line: "#69778f",
264 muted: "#bac5d6",
265 selected: "#4c566a",
266 button: "#88c0d0",
267 buttonInk: "#2e3440",
268 success: "#a3be8c",
269 danger: "#e39aa3",
270 warning: "#ebcb8b",
271 },
272 {
273 black: "#4c566a",
274 red: "#e39aa3",
275 green: "#a3be8c",
276 yellow: "#ebcb8b",
277 blue: "#81a1c1",
278 magenta: "#b48ead",
279 cyan: "#8fbcbb",
280 white: "#e5e9f0",
281 brightBlack: "#9aa7b8",
282 brightWhite: "#eceff4",
283 },
284 ),
285 },
286 {
287 id: "dracula",
288 name: "Dracula",
289 group: "编辑器",
290 description: "紫灰底色,搭配粉、紫与青绿的鲜明终端色板。",
291 dark: dark(
292 "#bd93f9",
293 "#282a36",
294 "#f8f8f2",
295 {
296 chrome: "#21222c",
297 sidebar: "#21222c",
298 toolbar: "#21222c",
299 line: "#6272a4",
300 muted: "#b5bfdc",
301 selected: "#44475a",
302 button: "#bd93f9",
303 buttonInk: "#282a36",
304 success: "#50fa7b",
305 danger: "#ff8080",
306 warning: "#f1fa8c",
307 },
308 {
309 black: "#44475a",
310 red: "#ff8080",
311 green: "#50fa7b",
312 yellow: "#f1fa8c",
313 blue: "#bd93f9",
314 magenta: "#ff79c6",
315 cyan: "#8be9fd",
316 white: "#f8f8f2",
317 brightBlack: "#b5bfdc",
318 brightRed: "#ff9f9f",
319 brightGreen: "#8affaa",
320 brightYellow: "#ffffa5",
321 brightBlue: "#d6b7ff",
322 brightMagenta: "#ffa4da",
323 brightCyan: "#b2f2ff",
324 brightWhite: "#ffffff",
325 },
326 ),
327 },
328 {
329 id: "monokai",
330 name: "Monokai",
331 group: "编辑器",
332 description: "参考 VS Code Monokai,橄榄黑背景与鲜明的暖色强调。",
333 dark: dark(
334 "#f8c555",
335 "#272822",
336 "#f8f8f2",
337 {
338 chrome: "#1e1f1c",
339 sidebar: "#1e1f1c",
340 toolbar: "#1e1f1c",
341 line: "#75715e",
342 muted: "#c0bea8",
343 selected: "#414339",
344 button: "#f8c555",
345 buttonInk: "#272822",
346 success: "#a6e22e",
347 danger: "#ff719c",
348 warning: "#e6db74",
349 },
350 {
351 red: "#ff719c",
352 green: "#a6e22e",
353 yellow: "#e6db74",
354 blue: "#66d9ef",
355 magenta: "#ae81ff",
356 cyan: "#a1efe4",
357 white: "#f8f8f2",
358 brightBlack: "#c0bea8",
359 },
360 ),
361 },
362 {
363 id: "paper",
364 name: "纸白 · Typora 风格",
365 group: "阅读",
366 description:
367 "参考 Typora 的 GitHub 阅读主题,白纸、深灰文字和克制的蓝色链接。",
368 light: light(
369 "#336da0",
370 "#ffffff",
371 "#333333",
372 {
373 chrome: "#f7f7f7",
374 sidebar: "#f7f7f7",
375 toolbar: "#fafafa",
376 line: "#c8c8c8",
377 muted: "#666666",
378 strong: "#202020",
379 button: "#333333",
380 buttonInk: "#ffffff",
381 },
382 {
383 red: "#a33a3a",
384 green: "#426e37",
385 yellow: "#775b25",
386 blue: "#336da0",
387 magenta: "#865b8e",
388 cyan: "#226b70",
389 white: "#666666",
390 },
391 ),
392 },
393 {
394 id: "sepia",
395 name: "暖纸 · Sepia",
396 group: "阅读",
397 description: "参考 Typora 的暖纸阅读风格,米色背景、棕色强调与柔和分区。",
398 light: light(
399 "#80552f",
400 "#f8f0e3",
401 "#514437",
402 {
403 chrome: "#eee3d1",
404 sidebar: "#eee3d1",
405 toolbar: "#f3e9da",
406 line: "#b1a18b",
407 muted: "#6d5a48",
408 selected: "#e1d2bb",
409 button: "#80552f",
410 buttonInk: "#fffaf1",
411 link: "#76502e",
412 },
413 {
414 red: "#993c2c",
415 green: "#4f652c",
416 yellow: "#775314",
417 blue: "#355e85",
418 magenta: "#79517e",
419 cyan: "#28665f",
420 white: "#6d5a48",
421 },
422 ),
423 },
424 {
425 id: "night",
426 name: "夜间 · Typora 风格",
427 group: "阅读",
428 description: "参考 Typora Night,使用柔和蓝灰底色与较低饱和度的强调色。",
429 dark: dark(
430 "#a6c9ea",
431 "#363b40",
432 "#e0e4e8",
433 {
434 chrome: "#2b3035",
435 sidebar: "#2b3035",
436 toolbar: "#2b3035",
437 line: "#75818b",
438 muted: "#b8bfc6",
439 selected: "#505b65",
440 button: "#a6c9ea",
441 buttonInk: "#263440",
442 success: "#b1d0a7",
443 danger: "#f0a5a5",
444 warning: "#e7c78c",
445 },
446 {
447 red: "#f0a5a5",
448 green: "#b1d0a7",
449 yellow: "#e7c78c",
450 blue: "#a6c9ea",
451 magenta: "#cfb0db",
452 cyan: "#a1d4cf",
453 white: "#e0e4e8",
454 brightBlack: "#b8bfc6",
455 },
456 ),
457 },
458 {
459 id: "color-vision",
460 name: "色觉友好 · 蓝橙",
461 group: "无障碍",
462 description:
463 "用蓝色和橙色区分成功与错误,减少红绿依赖;状态仍有图标和文字。",
464 light: {
465 ...light(
466 "#005a9c",
467 "#ffffff",
468 "#17212b",
469 {
470 chrome: "#f2f5f8",
471 sidebar: "#f2f5f8",
472 toolbar: "#f2f5f8",
473 chromeDark: "#e8edf2",
474 strong: "#0c1722",
475 muted: "#46596b",
476 line: "#6b7785",
477 input: "#ffffff",
478 hover: "#e5edf5",
479 selected: "#c9dff2",
480 selection: "#c9dff2",
481 button: "#005a9c",
482 buttonInk: "#ffffff",
483 accentInk: "#ffffff",
484 link: "#005a9c",
485 focus: "#005a9c",
486 success: "#005a9c",
487 danger: "#a63b00",
488 warning: "#735700",
489 inactive: "#546477",
490 },
491 {
492 black: "#17212b",
493 red: "#a63b00",
494 green: "#005a9c",
495 yellow: "#735700",
496 blue: "#5a3cbd",
497 magenta: "#a13d75",
498 cyan: "#006b63",
499 white: "#5c6673",
500 brightBlack: "#46596b",
501 brightRed: "#9c3500",
502 brightGreen: "#004c86",
503 brightYellow: "#654b00",
504 brightBlue: "#4d329f",
505 brightMagenta: "#8c3265",
506 brightCyan: "#005c55",
507 brightWhite: "#384552",
508 },
509 ),
510 opaqueWindows: true,
511 },
512 dark: {
513 ...dark(
514 "#56b4e9",
515 "#121b24",
516 "#f1f5f9",
517 {
518 chrome: "#1b2835",
519 sidebar: "#1b2835",
520 toolbar: "#1b2835",
521 chromeDark: "#233447",
522 strong: "#ffffff",
523 muted: "#b3c4d6",
524 line: "#8197ab",
525 input: "#121b24",
526 hover: "#2b4056",
527 selected: "#334c66",
528 selection: "#334c66",
529 button: "#56b4e9",
530 buttonInk: "#0a1822",
531 accentInk: "#0a1822",
532 link: "#87cefa",
533 focus: "#ffcc80",
534 success: "#56b4e9",
535 danger: "#ffad66",
536 warning: "#e6d55a",
537 inactive: "#a6b3c3",
538 },
539 {
540 black: "#a7b6c2",
541 red: "#ffad66",
542 green: "#56b4e9",
543 yellow: "#e6d55a",
544 blue: "#a89dff",
545 magenta: "#f19ccb",
546 cyan: "#74d6c5",
547 white: "#eceff4",
548 brightBlack: "#cad5df",
549 brightRed: "#ffc18f",
550 brightGreen: "#87cefa",
551 brightYellow: "#f2e68b",
552 brightBlue: "#c6beff",
553 brightMagenta: "#f7bfdf",
554 brightCyan: "#a1e9dc",
555 brightWhite: "#ffffff",
556 },
557 ),
558 opaqueWindows: true,
559 },
560 },
561 {
562 id: "high-contrast",
563 name: "高对比",
564 group: "无障碍",
565 description:
566 "提高文字、边框和焦点的对比度,关闭半透明侧栏;浅色为白底,深色为黑底。",
567 light: {
568 ...light(
569 "#002b66",
570 "#ffffff",
571 "#000000",
572 {
573 chrome: "#ffffff",
574 sidebar: "#ffffff",
575 toolbar: "#ffffff",
576 chromeDark: "#f0f0f0",
577 strong: "#000000",
578 muted: "#333333",
579 line: "#595959",
580 input: "#ffffff",
581 hover: "#ededed",
582 selected: "#e0e0e0",
583 selection: "#d4d4d4",
584 button: "#000000",
585 buttonInk: "#ffffff",
586 accentInk: "#ffffff",
587 link: "#002b66",
588 focus: "#000000",
589 success: "#003b73",
590 danger: "#8a2800",
591 warning: "#554000",
592 inactive: "#3f3f3f",
593 },
594 {
595 black: "#000000",
596 red: "#8a2800",
597 green: "#003b73",
598 yellow: "#554000",
599 blue: "#003587",
600 magenta: "#651153",
601 cyan: "#005248",
602 white: "#3f3f3f",
603 brightBlack: "#333333",
604 brightRed: "#792200",
605 brightGreen: "#00315f",
606 brightYellow: "#483600",
607 brightBlue: "#002d72",
608 brightMagenta: "#580d47",
609 brightCyan: "#00453c",
610 brightWhite: "#202020",
611 },
612 ),
613 opaqueWindows: true,
614 },
615 dark: {
616 ...dark(
617 "#00e5ff",
618 "#000000",
619 "#ffffff",
620 {
621 chrome: "#000000",
622 sidebar: "#000000",
623 toolbar: "#000000",
624 chromeDark: "#151515",
625 strong: "#ffffff",
626 muted: "#dedede",
627 line: "#a6a6a6",
628 input: "#000000",
629 hover: "#1c1c1c",
630 selected: "#252525",
631 selection: "#424242",
632 button: "#ffffff",
633 buttonInk: "#000000",
634 accentInk: "#000000",
635 link: "#64d8ff",
636 focus: "#ffff00",
637 success: "#75d8ff",
638 danger: "#ffb86b",
639 warning: "#ffea00",
640 inactive: "#d0d0d0",
641 },
642 {
643 black: "#bdbdbd",
644 red: "#ffb86b",
645 green: "#75d8ff",
646 yellow: "#ffea00",
647 blue: "#8fbfff",
648 magenta: "#f4aaff",
649 cyan: "#79f4dc",
650 white: "#eeeeee",
651 brightBlack: "#dedede",
652 brightRed: "#ffd2a6",
653 brightGreen: "#b7edff",
654 brightYellow: "#fff59d",
655 brightBlue: "#c4dcff",
656 brightMagenta: "#f9d3ff",
657 brightCyan: "#b9ffef",
658 brightWhite: "#ffffff",
659 },
660 ),
661 opaqueWindows: true,
662 },
663 },
664];
665
666export const presets = Object.fromEntries(
667 ["light", "dark"].map((variant) => [
668 variant,
669 Object.fromEntries(
670 themeCatalog
671 .filter((item) => item[variant])
672 .map((item) => [item.id, item[variant]]),
673 ),
674 ]),
675);
676export const presetNames = Object.fromEntries(
677 themeCatalog.map((item) => [item.id, item.name]),
678);
679export const presetGroups = ["经典", "编辑器", "阅读", "无障碍"];
680export const presetInfo = Object.fromEntries(
681 themeCatalog.map((item) => [item.id, item]),
682);
683
684export function applyThemePreset(current, variant, id) {
685 const preset = presets[variant]?.[id];
686 if (!preset) throw new Error("所选主题不支持当前明暗模式");
687 return {
688 ...current,
689 ...structuredClone(preset),
690 preset: id,
691 colors: structuredClone(preset.colors),
692 terminal: structuredClone(preset.terminal),
693 };
694}