Open History to see the last commit
1export type TerminalAppearanceScheme = "light" | "dark";
2
3export interface TerminalTheme {
4 readonly background: string;
5 readonly foreground: string;
6 readonly mutedForeground: string;
7 readonly border: string;
8 readonly cursorForeground: string;
9 readonly cursorBackground: string;
10 readonly palette: readonly string[];
11}
12
13const PIERRE_LIGHT_THEME: TerminalTheme = {
14 // Pierre terminal palette with the app's shared screen background.
15 background: "#f2f2f7",
16 foreground: "#6C6C71",
17 mutedForeground: "#8E8E95",
18 border: "#eeeeef",
19 cursorForeground: "#009fff",
20 cursorBackground: "#f2f2f7",
21 palette: [
22 "#1F1F21",
23 "#ff2e3f",
24 "#0dbe4e",
25 "#ffca00",
26 "#009fff",
27 "#c635e4",
28 "#08c0ef",
29 "#c6c6c8",
30 "#1F1F21",
31 "#ff2e3f",
32 "#0dbe4e",
33 "#ffca00",
34 "#009fff",
35 "#c635e4",
36 "#08c0ef",
37 "#c6c6c8",
38 ],
39};
40
41const PIERRE_DARK_THEME: TerminalTheme = {
42 // Pierre terminal palette with the app's shared screen background.
43 background: "#0a0a0a",
44 foreground: "#adadb1",
45 mutedForeground: "#8E8E95",
46 border: "#2e2e30",
47 cursorForeground: "#009fff",
48 cursorBackground: "#0a0a0a",
49 palette: [
50 "#141415",
51 "#ff2e3f",
52 "#0dbe4e",
53 "#ffca00",
54 "#009fff",
55 "#c635e4",
56 "#08c0ef",
57 "#c6c6c8",
58 "#141415",
59 "#ff2e3f",
60 "#0dbe4e",
61 "#ffca00",
62 "#009fff",
63 "#c635e4",
64 "#08c0ef",
65 "#c6c6c8",
66 ],
67};
68
69export function getPierreTerminalTheme(scheme: TerminalAppearanceScheme): TerminalTheme {
70 return scheme === "light" ? PIERRE_LIGHT_THEME : PIERRE_DARK_THEME;
71}
72
73export function buildGhosttyThemeConfig(theme: TerminalTheme): string {
74 const lines = [
75 `background = ${theme.background}`,
76 `foreground = ${theme.foreground}`,
77 `cursor-color = ${theme.cursorForeground}`,
78 `cursor-text = ${theme.cursorBackground}`,
79 ];
80
81 for (const [index, color] of theme.palette.entries()) {
82 lines.push(`palette = ${index}=${color}`);
83 }
84
85 return `${lines.join("\n")}\n`;
86}