pi-theme-vitesse 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/extensions/vitesse-system-theme.ts +87 -0
- package/package.json +44 -0
- package/themes/vitesse-dark.json +91 -0
- package/themes/vitesse-light.json +91 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# pi-theme-vitesse
|
|
2
|
+
|
|
3
|
+
Vitesse-inspired dark and light themes for [Pi Coding Agent](https://pi.dev/), plus an extension that switches between them using macOS system appearance.
|
|
4
|
+
|
|
5
|
+
## Themes
|
|
6
|
+
|
|
7
|
+
- `vitesse-dark`
|
|
8
|
+
- `vitesse-light`
|
|
9
|
+
|
|
10
|
+
## Extension
|
|
11
|
+
|
|
12
|
+
`extensions/vitesse-system-theme.ts` checks macOS dark mode with `osascript` when a Pi session starts, then polls every 2 seconds and applies:
|
|
13
|
+
|
|
14
|
+
- `vitesse-dark` when macOS is in dark mode
|
|
15
|
+
- `vitesse-light` when macOS is in light mode
|
|
16
|
+
|
|
17
|
+
The extension only runs in UI sessions. If theme application fails during startup, it shows a Pi notification.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
From this repo:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pi install ./packages/pi-theme-vitesse
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
After installing, run `/reload` in an active Pi session or start a new session. The extension will keep the active theme in sync with macOS appearance.
|
|
28
|
+
|
|
29
|
+
You can also manually select `vitesse-dark` or `vitesse-light` from `/settings`, or set one in `~/.pi/agent/settings.json`:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"theme": "vitesse-dark"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Credit
|
|
38
|
+
|
|
39
|
+
This package adapts the Vitesse color palette for Pi's TUI theme format.
|
|
40
|
+
Original Vitesse theme: [antfu/vscode-theme-vitesse](https://github.com/antfu/vscode-theme-vitesse) by [Anthony Fu](https://github.com/antfu).
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync pi with macOS system appearance using custom Vitesse themes.
|
|
3
|
+
*
|
|
4
|
+
* Requires the pi-theme-vitesse package themes to be loaded:
|
|
5
|
+
* themes/vitesse-dark.json
|
|
6
|
+
* themes/vitesse-light.json
|
|
7
|
+
*
|
|
8
|
+
* Run /reload in an active pi session after installing or editing this package.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { execFile } from "node:child_process";
|
|
12
|
+
import { promisify } from "node:util";
|
|
13
|
+
import type {
|
|
14
|
+
ExtensionAPI,
|
|
15
|
+
ExtensionContext,
|
|
16
|
+
} from "@earendil-works/pi-coding-agent";
|
|
17
|
+
|
|
18
|
+
const execFileAsync = promisify(execFile);
|
|
19
|
+
|
|
20
|
+
const DARK_THEME = "vitesse-dark";
|
|
21
|
+
const LIGHT_THEME = "vitesse-light";
|
|
22
|
+
const POLL_INTERVAL_MS = 2000;
|
|
23
|
+
|
|
24
|
+
async function isMacDarkMode(): Promise<boolean> {
|
|
25
|
+
try {
|
|
26
|
+
const { stdout } = await execFileAsync("osascript", [
|
|
27
|
+
"-e",
|
|
28
|
+
'tell application "System Events" to tell appearance preferences to return dark mode',
|
|
29
|
+
]);
|
|
30
|
+
return stdout.trim() === "true";
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function systemThemeName(): Promise<string> {
|
|
37
|
+
return (await isMacDarkMode()) ? DARK_THEME : LIGHT_THEME;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default function (pi: ExtensionAPI) {
|
|
41
|
+
let intervalId: ReturnType<typeof setInterval> | null = null;
|
|
42
|
+
let currentTheme: string | null = null;
|
|
43
|
+
let checking = false;
|
|
44
|
+
|
|
45
|
+
async function applySystemTheme(
|
|
46
|
+
ctx: ExtensionContext,
|
|
47
|
+
notifyOnError = false,
|
|
48
|
+
) {
|
|
49
|
+
if (!ctx.hasUI) return;
|
|
50
|
+
if (checking) return;
|
|
51
|
+
|
|
52
|
+
checking = true;
|
|
53
|
+
try {
|
|
54
|
+
const nextTheme = await systemThemeName();
|
|
55
|
+
if (nextTheme === currentTheme) return;
|
|
56
|
+
|
|
57
|
+
const result = ctx.ui.setTheme(nextTheme);
|
|
58
|
+
if (result.success) {
|
|
59
|
+
currentTheme = nextTheme;
|
|
60
|
+
} else if (notifyOnError) {
|
|
61
|
+
ctx.ui.notify(`Vitesse system theme failed: ${result.error}`, "error");
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
checking = false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
69
|
+
if (intervalId) clearInterval(intervalId);
|
|
70
|
+
currentTheme = null;
|
|
71
|
+
|
|
72
|
+
await applySystemTheme(ctx, true);
|
|
73
|
+
|
|
74
|
+
intervalId = setInterval(() => {
|
|
75
|
+
void applySystemTheme(ctx);
|
|
76
|
+
}, POLL_INTERVAL_MS);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
pi.on("session_shutdown", () => {
|
|
80
|
+
if (intervalId) {
|
|
81
|
+
clearInterval(intervalId);
|
|
82
|
+
intervalId = null;
|
|
83
|
+
}
|
|
84
|
+
currentTheme = null;
|
|
85
|
+
checking = false;
|
|
86
|
+
});
|
|
87
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-theme-vitesse",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Vitesse-inspired themes and automatic system appearance switching for Pi Coding Agent.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"pi-package",
|
|
9
|
+
"pi-theme",
|
|
10
|
+
"vitesse"
|
|
11
|
+
],
|
|
12
|
+
"files": [
|
|
13
|
+
"extensions",
|
|
14
|
+
"themes",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/hannoeru/pi-custom.git",
|
|
20
|
+
"directory": "packages/pi-theme-vitesse"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public",
|
|
24
|
+
"registry": "https://registry.npmjs.org/"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@earendil-works/pi-coding-agent": "*"
|
|
31
|
+
},
|
|
32
|
+
"pi": {
|
|
33
|
+
"extensions": [
|
|
34
|
+
"./extensions/vitesse-system-theme.ts"
|
|
35
|
+
],
|
|
36
|
+
"themes": [
|
|
37
|
+
"./themes"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@earendil-works/pi-coding-agent": "^0.78.0",
|
|
42
|
+
"@types/node": "^25.9.1"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "vitesse-dark",
|
|
4
|
+
"vars": {
|
|
5
|
+
"primary": "#4d9375",
|
|
6
|
+
"foreground": "#dbd7ca",
|
|
7
|
+
"activeForeground": "#bfbaaa",
|
|
8
|
+
"mutedText": "#84837f",
|
|
9
|
+
"dimText": "#585754",
|
|
10
|
+
"border": "#191919",
|
|
11
|
+
"borderMuted": "#2f363d",
|
|
12
|
+
"background": "#121212",
|
|
13
|
+
"activeBackground": "#181818",
|
|
14
|
+
"selectedBackground": "#202020",
|
|
15
|
+
"successBg": "#171d1a",
|
|
16
|
+
"errorBg": "#211817",
|
|
17
|
+
"green": "#4d9375",
|
|
18
|
+
"cyan": "#5eaab5",
|
|
19
|
+
"blue": "#6394bf",
|
|
20
|
+
"red": "#cb7676",
|
|
21
|
+
"orange": "#d4976c",
|
|
22
|
+
"yellow": "#e6cc77",
|
|
23
|
+
"magenta": "#d9739f",
|
|
24
|
+
"comment": "#758575",
|
|
25
|
+
"string": "#c98a7d",
|
|
26
|
+
"variable": "#bd976a",
|
|
27
|
+
"keyword": "#4d9375",
|
|
28
|
+
"number": "#4c9a91",
|
|
29
|
+
"type": "#5da994",
|
|
30
|
+
"operator": "#cb7676",
|
|
31
|
+
"punctuation": "#666666"
|
|
32
|
+
},
|
|
33
|
+
"colors": {
|
|
34
|
+
"accent": "blue",
|
|
35
|
+
"border": "border",
|
|
36
|
+
"borderAccent": "blue",
|
|
37
|
+
"borderMuted": "borderMuted",
|
|
38
|
+
"success": "green",
|
|
39
|
+
"error": "red",
|
|
40
|
+
"warning": "orange",
|
|
41
|
+
"muted": "mutedText",
|
|
42
|
+
"dim": "dimText",
|
|
43
|
+
"text": "foreground",
|
|
44
|
+
"thinkingText": "mutedText",
|
|
45
|
+
"selectedBg": "selectedBackground",
|
|
46
|
+
"userMessageBg": "activeBackground",
|
|
47
|
+
"userMessageText": "foreground",
|
|
48
|
+
"customMessageBg": "activeBackground",
|
|
49
|
+
"customMessageText": "foreground",
|
|
50
|
+
"customMessageLabel": "primary",
|
|
51
|
+
"toolPendingBg": "activeBackground",
|
|
52
|
+
"toolSuccessBg": "successBg",
|
|
53
|
+
"toolErrorBg": "errorBg",
|
|
54
|
+
"toolTitle": "blue",
|
|
55
|
+
"toolOutput": "foreground",
|
|
56
|
+
"mdHeading": "primary",
|
|
57
|
+
"mdLink": "primary",
|
|
58
|
+
"mdLinkUrl": "mutedText",
|
|
59
|
+
"mdCode": "cyan",
|
|
60
|
+
"mdCodeBlock": "foreground",
|
|
61
|
+
"mdCodeBlockBorder": "borderMuted",
|
|
62
|
+
"mdQuote": "blue",
|
|
63
|
+
"mdQuoteBorder": "borderMuted",
|
|
64
|
+
"mdHr": "borderMuted",
|
|
65
|
+
"mdListBullet": "orange",
|
|
66
|
+
"toolDiffAdded": "green",
|
|
67
|
+
"toolDiffRemoved": "red",
|
|
68
|
+
"toolDiffContext": "mutedText",
|
|
69
|
+
"syntaxComment": "comment",
|
|
70
|
+
"syntaxKeyword": "keyword",
|
|
71
|
+
"syntaxFunction": "#80a665",
|
|
72
|
+
"syntaxVariable": "variable",
|
|
73
|
+
"syntaxString": "string",
|
|
74
|
+
"syntaxNumber": "number",
|
|
75
|
+
"syntaxType": "type",
|
|
76
|
+
"syntaxOperator": "operator",
|
|
77
|
+
"syntaxPunctuation": "punctuation",
|
|
78
|
+
"thinkingOff": "dimText",
|
|
79
|
+
"thinkingMinimal": "primary",
|
|
80
|
+
"thinkingLow": "blue",
|
|
81
|
+
"thinkingMedium": "cyan",
|
|
82
|
+
"thinkingHigh": "magenta",
|
|
83
|
+
"thinkingXhigh": "red",
|
|
84
|
+
"bashMode": "yellow"
|
|
85
|
+
},
|
|
86
|
+
"export": {
|
|
87
|
+
"pageBg": "background",
|
|
88
|
+
"cardBg": "activeBackground",
|
|
89
|
+
"infoBg": "#1c1c1c"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "vitesse-light",
|
|
4
|
+
"vars": {
|
|
5
|
+
"primary": "#1c6b48",
|
|
6
|
+
"foreground": "#393a34",
|
|
7
|
+
"activeForeground": "#4e4f47",
|
|
8
|
+
"mutedText": "#6a737d",
|
|
9
|
+
"dimText": "#90918d",
|
|
10
|
+
"border": "#f0f0f0",
|
|
11
|
+
"borderMuted": "#e1e4e8",
|
|
12
|
+
"background": "#ffffff",
|
|
13
|
+
"activeBackground": "#f7f7f7",
|
|
14
|
+
"selectedBackground": "#eeeeee",
|
|
15
|
+
"successBg": "#f1f6f3",
|
|
16
|
+
"errorBg": "#fbf0ef",
|
|
17
|
+
"green": "#1e754f",
|
|
18
|
+
"cyan": "#2993a3",
|
|
19
|
+
"blue": "#296aa3",
|
|
20
|
+
"red": "#ab5959",
|
|
21
|
+
"orange": "#a65e2b",
|
|
22
|
+
"yellow": "#bda437",
|
|
23
|
+
"magenta": "#a13865",
|
|
24
|
+
"comment": "#a0ada0",
|
|
25
|
+
"string": "#b56959",
|
|
26
|
+
"variable": "#b07d48",
|
|
27
|
+
"keyword": "#1e754f",
|
|
28
|
+
"number": "#2f798a",
|
|
29
|
+
"type": "#2e8f82",
|
|
30
|
+
"operator": "#ab5959",
|
|
31
|
+
"punctuation": "#999999"
|
|
32
|
+
},
|
|
33
|
+
"colors": {
|
|
34
|
+
"accent": "blue",
|
|
35
|
+
"border": "border",
|
|
36
|
+
"borderAccent": "blue",
|
|
37
|
+
"borderMuted": "borderMuted",
|
|
38
|
+
"success": "green",
|
|
39
|
+
"error": "red",
|
|
40
|
+
"warning": "orange",
|
|
41
|
+
"muted": "mutedText",
|
|
42
|
+
"dim": "dimText",
|
|
43
|
+
"text": "foreground",
|
|
44
|
+
"thinkingText": "mutedText",
|
|
45
|
+
"selectedBg": "selectedBackground",
|
|
46
|
+
"userMessageBg": "activeBackground",
|
|
47
|
+
"userMessageText": "foreground",
|
|
48
|
+
"customMessageBg": "activeBackground",
|
|
49
|
+
"customMessageText": "foreground",
|
|
50
|
+
"customMessageLabel": "primary",
|
|
51
|
+
"toolPendingBg": "activeBackground",
|
|
52
|
+
"toolSuccessBg": "successBg",
|
|
53
|
+
"toolErrorBg": "errorBg",
|
|
54
|
+
"toolTitle": "blue",
|
|
55
|
+
"toolOutput": "foreground",
|
|
56
|
+
"mdHeading": "primary",
|
|
57
|
+
"mdLink": "primary",
|
|
58
|
+
"mdLinkUrl": "mutedText",
|
|
59
|
+
"mdCode": "cyan",
|
|
60
|
+
"mdCodeBlock": "foreground",
|
|
61
|
+
"mdCodeBlockBorder": "borderMuted",
|
|
62
|
+
"mdQuote": "blue",
|
|
63
|
+
"mdQuoteBorder": "borderMuted",
|
|
64
|
+
"mdHr": "borderMuted",
|
|
65
|
+
"mdListBullet": "orange",
|
|
66
|
+
"toolDiffAdded": "green",
|
|
67
|
+
"toolDiffRemoved": "red",
|
|
68
|
+
"toolDiffContext": "mutedText",
|
|
69
|
+
"syntaxComment": "comment",
|
|
70
|
+
"syntaxKeyword": "keyword",
|
|
71
|
+
"syntaxFunction": "#59873a",
|
|
72
|
+
"syntaxVariable": "variable",
|
|
73
|
+
"syntaxString": "string",
|
|
74
|
+
"syntaxNumber": "number",
|
|
75
|
+
"syntaxType": "type",
|
|
76
|
+
"syntaxOperator": "operator",
|
|
77
|
+
"syntaxPunctuation": "punctuation",
|
|
78
|
+
"thinkingOff": "dimText",
|
|
79
|
+
"thinkingMinimal": "primary",
|
|
80
|
+
"thinkingLow": "blue",
|
|
81
|
+
"thinkingMedium": "cyan",
|
|
82
|
+
"thinkingHigh": "magenta",
|
|
83
|
+
"thinkingXhigh": "red",
|
|
84
|
+
"bashMode": "yellow"
|
|
85
|
+
},
|
|
86
|
+
"export": {
|
|
87
|
+
"pageBg": "background",
|
|
88
|
+
"cardBg": "activeBackground",
|
|
89
|
+
"infoBg": "#f1f0e9"
|
|
90
|
+
}
|
|
91
|
+
}
|