@pierre/theme 0.0.25 → 0.0.27
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/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/pierre-dark-vibrant.d.mts +15 -0
- package/dist/pierre-dark-vibrant.mjs +1 -0
- package/dist/pierre-dark.d.mts +15 -0
- package/dist/pierre-dark.mjs +1 -0
- package/dist/pierre-light-vibrant.d.mts +15 -0
- package/dist/pierre-light-vibrant.mjs +1 -0
- package/dist/pierre-light.d.mts +15 -0
- package/dist/pierre-light.mjs +1 -0
- package/package.json +26 -6
- package/.github/workflows/publish.yml +0 -68
- package/.github/workflows/test.yml +0 -80
- package/.vscode/extensions.json +0 -5
- package/.vscode/launch.json +0 -24
- package/.vscode/tasks.json +0 -24
- package/.vscodeignore +0 -10
- package/CONTRIBUTING.md +0 -75
- package/DISPLAY-P3.md +0 -120
- package/src/build.ts +0 -60
- package/src/color-p3.ts +0 -229
- package/src/demo-p3.ts +0 -44
- package/src/package-vsix.ts +0 -22
- package/src/palette.ts +0 -379
- package/src/test.ts +0 -272
- package/src/theme.ts +0 -615
- package/src/zed-theme.ts +0 -606
- package/tsconfig.json +0 -21
- package/zed/LICENSE.md +0 -21
- package/zed/README.md +0 -25
- package/zed/extension.toml +0 -7
- package/zed/themes/pierre.json +0 -991
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@pierre/theme",
|
|
3
3
|
"displayName": "Pierre Theme",
|
|
4
4
|
"description": "Pierre theme for Shiki, VS Code, and more",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.27",
|
|
6
6
|
"publisher": "pierrecomputer",
|
|
7
7
|
"icon": "icon.png",
|
|
8
8
|
"galleryBanner": {
|
|
@@ -57,12 +57,32 @@
|
|
|
57
57
|
"typescript": "^5.9.3"
|
|
58
58
|
},
|
|
59
59
|
"sideEffects": false,
|
|
60
|
+
"files": [
|
|
61
|
+
"dist",
|
|
62
|
+
"themes",
|
|
63
|
+
"icon.png"
|
|
64
|
+
],
|
|
60
65
|
"exports": {
|
|
61
|
-
".":
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"./pierre-
|
|
66
|
+
".": {
|
|
67
|
+
"types": "./dist/index.d.mts",
|
|
68
|
+
"default": "./dist/index.mjs"
|
|
69
|
+
},
|
|
70
|
+
"./pierre-dark": {
|
|
71
|
+
"types": "./dist/pierre-dark.d.mts",
|
|
72
|
+
"default": "./dist/pierre-dark.mjs"
|
|
73
|
+
},
|
|
74
|
+
"./pierre-light": {
|
|
75
|
+
"types": "./dist/pierre-light.d.mts",
|
|
76
|
+
"default": "./dist/pierre-light.mjs"
|
|
77
|
+
},
|
|
78
|
+
"./pierre-dark-vibrant": {
|
|
79
|
+
"types": "./dist/pierre-dark-vibrant.d.mts",
|
|
80
|
+
"default": "./dist/pierre-dark-vibrant.mjs"
|
|
81
|
+
},
|
|
82
|
+
"./pierre-light-vibrant": {
|
|
83
|
+
"types": "./dist/pierre-light-vibrant.d.mts",
|
|
84
|
+
"default": "./dist/pierre-light-vibrant.mjs"
|
|
85
|
+
},
|
|
66
86
|
"./themes/*": "./themes/*"
|
|
67
87
|
},
|
|
68
88
|
"publishConfig": {
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
name: Publish
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
package:
|
|
9
|
-
name: Publish to VS Marketplace & Open VSX
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout code
|
|
14
|
-
uses: actions/checkout@v4
|
|
15
|
-
|
|
16
|
-
- name: Setup Node.js
|
|
17
|
-
uses: actions/setup-node@v4
|
|
18
|
-
with:
|
|
19
|
-
node-version: '20'
|
|
20
|
-
cache: 'npm'
|
|
21
|
-
|
|
22
|
-
- name: Install dependencies
|
|
23
|
-
run: npm ci
|
|
24
|
-
|
|
25
|
-
- name: Build theme
|
|
26
|
-
run: npm run build
|
|
27
|
-
|
|
28
|
-
- name: Rename package for extension publishing
|
|
29
|
-
run: jq '.name = "pierre-theme"' package.json > tmp.json && mv tmp.json package.json
|
|
30
|
-
|
|
31
|
-
- name: Publish to VS Marketplace
|
|
32
|
-
env:
|
|
33
|
-
VSCE_PAT: ${{ secrets.VSCE_PAT }}
|
|
34
|
-
run: npx @vscode/vsce publish --pat $VSCE_PAT
|
|
35
|
-
|
|
36
|
-
- name: Publish to Open VSX
|
|
37
|
-
env:
|
|
38
|
-
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}
|
|
39
|
-
run: npx ovsx publish --pat $OVSX_PAT
|
|
40
|
-
|
|
41
|
-
npm:
|
|
42
|
-
name: Publish to npm
|
|
43
|
-
runs-on: ubuntu-latest
|
|
44
|
-
permissions:
|
|
45
|
-
id-token: write
|
|
46
|
-
contents: read
|
|
47
|
-
|
|
48
|
-
steps:
|
|
49
|
-
- name: Checkout code
|
|
50
|
-
uses: actions/checkout@v4
|
|
51
|
-
|
|
52
|
-
- name: Setup Node.js
|
|
53
|
-
uses: actions/setup-node@v4
|
|
54
|
-
with:
|
|
55
|
-
node-version: '20'
|
|
56
|
-
cache: 'npm'
|
|
57
|
-
registry-url: 'https://registry.npmjs.org'
|
|
58
|
-
|
|
59
|
-
- name: Install dependencies
|
|
60
|
-
run: npm ci
|
|
61
|
-
|
|
62
|
-
- name: Build theme
|
|
63
|
-
run: npm run build
|
|
64
|
-
|
|
65
|
-
- name: Publish to npm
|
|
66
|
-
env:
|
|
67
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
68
|
-
run: npm publish --access public --provenance
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
name: Test & Build
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches: [main]
|
|
6
|
-
push:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout code
|
|
15
|
-
uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- name: Setup Node.js
|
|
18
|
-
uses: actions/setup-node@v4
|
|
19
|
-
with:
|
|
20
|
-
node-version: '20'
|
|
21
|
-
cache: 'npm'
|
|
22
|
-
|
|
23
|
-
- name: Install dependencies
|
|
24
|
-
run: npm ci
|
|
25
|
-
|
|
26
|
-
- name: Run TypeScript compilation check
|
|
27
|
-
run: npx tsc --noEmit
|
|
28
|
-
|
|
29
|
-
- name: Build theme files
|
|
30
|
-
run: npm run build
|
|
31
|
-
|
|
32
|
-
- name: Run tests
|
|
33
|
-
run: npm test
|
|
34
|
-
|
|
35
|
-
- name: Verify theme files exist
|
|
36
|
-
run: |
|
|
37
|
-
if [ ! -f "themes/pierre-light.json" ]; then
|
|
38
|
-
echo "❌ pierre-light.json not generated"
|
|
39
|
-
exit 1
|
|
40
|
-
fi
|
|
41
|
-
if [ ! -f "themes/pierre-dark.json" ]; then
|
|
42
|
-
echo "❌ pierre-dark.json not generated"
|
|
43
|
-
exit 1
|
|
44
|
-
fi
|
|
45
|
-
echo "✅ All theme files generated successfully"
|
|
46
|
-
|
|
47
|
-
- name: Verify ESM wrapper modules exist
|
|
48
|
-
run: |
|
|
49
|
-
for theme in pierre-dark pierre-light pierre-dark-vibrant pierre-light-vibrant; do
|
|
50
|
-
if [ ! -f "dist/${theme}.mjs" ]; then
|
|
51
|
-
echo "❌ dist/${theme}.mjs not generated"
|
|
52
|
-
exit 1
|
|
53
|
-
fi
|
|
54
|
-
done
|
|
55
|
-
if [ ! -f "dist/index.mjs" ]; then
|
|
56
|
-
echo "❌ dist/index.mjs not generated"
|
|
57
|
-
exit 1
|
|
58
|
-
fi
|
|
59
|
-
echo "✅ All ESM wrapper modules generated successfully"
|
|
60
|
-
|
|
61
|
-
- name: Check file sizes
|
|
62
|
-
run: |
|
|
63
|
-
light_size=$(wc -c < themes/pierre-light.json)
|
|
64
|
-
dark_size=$(wc -c < themes/pierre-dark.json)
|
|
65
|
-
|
|
66
|
-
echo "📊 Theme file sizes:"
|
|
67
|
-
echo " - pierre-light.json: $light_size bytes"
|
|
68
|
-
echo " - pierre-dark.json: $dark_size bytes"
|
|
69
|
-
|
|
70
|
-
# Sanity check - themes should be at least 10KB
|
|
71
|
-
if [ $light_size -lt 10000 ]; then
|
|
72
|
-
echo "❌ pierre-light.json seems too small ($light_size bytes)"
|
|
73
|
-
exit 1
|
|
74
|
-
fi
|
|
75
|
-
if [ $dark_size -lt 10000 ]; then
|
|
76
|
-
echo "❌ pierre-dark.json seems too small ($dark_size bytes)"
|
|
77
|
-
exit 1
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
echo "✅ Theme files are properly sized"
|
package/.vscode/extensions.json
DELETED
package/.vscode/launch.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// A launch configuration that launches the extension inside a new window
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
{
|
|
6
|
-
"version": "0.2.0",
|
|
7
|
-
"configurations": [
|
|
8
|
-
{
|
|
9
|
-
"name": "Run Extension",
|
|
10
|
-
"type": "extensionHost",
|
|
11
|
-
"request": "launch",
|
|
12
|
-
"runtimeExecutable": "${execPath}",
|
|
13
|
-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
|
|
14
|
-
"preLaunchTask": "npm: build"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"name": "Run Extension Without Build",
|
|
18
|
-
"type": "extensionHost",
|
|
19
|
-
"request": "launch",
|
|
20
|
-
"runtimeExecutable": "${execPath}",
|
|
21
|
-
"args": ["--extensionDevelopmentPath=${workspaceFolder}"]
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
package/.vscode/tasks.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.0.0",
|
|
3
|
-
"tasks": [
|
|
4
|
-
{
|
|
5
|
-
"type": "npm",
|
|
6
|
-
"script": "start",
|
|
7
|
-
"group": {
|
|
8
|
-
"kind": "build",
|
|
9
|
-
"isDefault": true
|
|
10
|
-
},
|
|
11
|
-
"problemMatcher": [],
|
|
12
|
-
"label": "npm: start",
|
|
13
|
-
"detail": "nodemon --watch src src/index.js"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"type": "npm",
|
|
17
|
-
"script": "build",
|
|
18
|
-
"group": "build",
|
|
19
|
-
"problemMatcher": [],
|
|
20
|
-
"label": "npm: build",
|
|
21
|
-
"detail": "node src/index.js"
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
}
|
package/.vscodeignore
DELETED
package/CONTRIBUTING.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# Pierre Theme
|
|
2
|
-
|
|
3
|
-
Light and dark themes for Visual Studio Code, Cursor, Zed, and Shiki. Built for [Diffs.com](https://diffs.com) by [The Pierre Computer Company](https://pierre.computer).
|
|
4
|
-
|
|
5
|
-
## Preview
|
|
6
|
-
|
|
7
|
-

|
|
8
|
-

|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
### Visual Studio Code
|
|
13
|
-
|
|
14
|
-
From the menu in Visual Studio Code:
|
|
15
|
-
|
|
16
|
-
- View > Extensions (or hit Command+Shift+X or Control+Shift+X)
|
|
17
|
-
- Search for `Pierre Theme`
|
|
18
|
-
- Click install
|
|
19
|
-
|
|
20
|
-
You can also install or download from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=pierrecomputer.pierre-theme).
|
|
21
|
-
|
|
22
|
-
### Cursor
|
|
23
|
-
|
|
24
|
-
From the menu in Cursor:
|
|
25
|
-
|
|
26
|
-
- View > Extensions (or hit Command+Shift+X or Control+Shift+X)
|
|
27
|
-
- Search for `Pierre Theme`
|
|
28
|
-
- Click install
|
|
29
|
-
|
|
30
|
-
You can also install or download from the [Open VSX registry](https://open-vsx.org/extension/pierrecomputer/pierre-theme).
|
|
31
|
-
|
|
32
|
-
### Zed
|
|
33
|
-
|
|
34
|
-
From the menu in Zed:
|
|
35
|
-
|
|
36
|
-
- Zed > Extensions (or hit Command+Shift+X or Control+Shift+X)
|
|
37
|
-
- Search for `Pierre`
|
|
38
|
-
- Click install
|
|
39
|
-
|
|
40
|
-
## Vibrant themes (Display P3)
|
|
41
|
-
|
|
42
|
-
> [!NOTE]
|
|
43
|
-
> Vibrant themes do not work in VS Code or Cursor at this time as it does not support color formats other than Hex or RGB. You can, however, use these with [Diffs](https://diffs.com) or any [Shiki](https://shiki.style) project to render code.
|
|
44
|
-
|
|
45
|
-
The **Vibrant** theme variants use CSS's `color(display-p3 r g b)` format with enhanced saturation to fully utilize Display P3's wider color gamut. Display P3 can represent ~25% more colors than standard sRGB, and these themes are optimized to take full advantage of that on compatible displays.
|
|
46
|
-
|
|
47
|
-
The conversion algorithm transforms sRGB colors to Display P3 through proper linear color space transformations, then enhances saturation (15-30%) and luminance (5% for vibrant colors) to push colors into the wider P3 gamut that isn't accessible in sRGB.
|
|
48
|
-
|
|
49
|
-
## Override
|
|
50
|
-
|
|
51
|
-
To override this (or any other) theme in your personal config file, please follow the guide in the [color theme](https://code.visualstudio.com/api/extension-guides/color-theme) documentation. This is handy for small tweaks to the theme without having to fork and maintain your own theme.
|
|
52
|
-
|
|
53
|
-
## Contribute
|
|
54
|
-
|
|
55
|
-
1. Clone and open this [repo](https://github.com/pierrecomputer/theme) in your editor
|
|
56
|
-
2. Run `npm install` to install the dependencies.
|
|
57
|
-
3. Press `F5` to open a new window with your extension loaded
|
|
58
|
-
4. Open `Code > Preferences > Color Theme` [`⌘k ⌘t`] and pick the "Pierre…" theme you want to test.
|
|
59
|
-
5. Make changes to the [`/src/theme.ts`](https://github.com/pierrecomputer/theme/blob/main/src/theme.ts) file.
|
|
60
|
-
6. Run `npm run build` to update the theme. You can also run `npm run start` instead to automatically rebuild the theme while making changes and no reloading should be necessary.
|
|
61
|
-
7. Run `npm test` to validate your changes (this runs automatically on PRs).
|
|
62
|
-
8. Once you're happy, commit your changes and open a PR.
|
|
63
|
-
|
|
64
|
-
## Scripts
|
|
65
|
-
|
|
66
|
-
| Script | Description |
|
|
67
|
-
| --- | --- |
|
|
68
|
-
| `npm run build` | Builds the theme `.json` files in `./themes` directory |
|
|
69
|
-
| `npm test` | Runs validation tests on the theme (includes build) |
|
|
70
|
-
| `npm run package` | Compiles the theme `.vsix` file at the project root |
|
|
71
|
-
| `npm start` | Automatically runs build on file change |
|
|
72
|
-
|
|
73
|
-
## Credit
|
|
74
|
-
|
|
75
|
-
This theme was built on top of [GitHub's Visual Studio Code Theme](https://github.com/primer/github-vscode-theme). All credit to them for the technique and build tooling, which we've since iterated on for more specific language tokens.
|
package/DISPLAY-P3.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# Display P3 Color Space Implementation
|
|
2
|
-
|
|
3
|
-
This document covers the Display P3 color space implementation for the Pierre theme, including technical details for future reference.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The vibrant theme variants (`pierre-light-vibrant.json` and `pierre-dark-vibrant.json`) use CSS `color(display-p3 r g b)` format with saturation enhancement to fully utilize Display P3's wider color gamut. These themes are designed for web projects using [Shiki](https://shiki.style/) syntax highlighting. They won't work in VS Code itself, as VS Code only supports hex/RGB color formats.
|
|
8
|
-
|
|
9
|
-
## Color Conversion Process
|
|
10
|
-
|
|
11
|
-
### 1. Linear Transformation
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
// 1. Parse hex → RGB (0-1 range)
|
|
15
|
-
const [r, g, b] = hexToRgb01(hex)
|
|
16
|
-
|
|
17
|
-
// 2. Linearize sRGB (remove gamma)
|
|
18
|
-
const linear = srgbToLinear(rgb)
|
|
19
|
-
|
|
20
|
-
// 3. Transform to P3 color space (matrix transformation)
|
|
21
|
-
const [rP3, gP3, bP3] = linearSrgbToLinearP3(linearR, linearG, linearB)
|
|
22
|
-
|
|
23
|
-
// 4. Apply P3 gamma
|
|
24
|
-
const displayP3 = linearToP3(linearP3)
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Transformation Matrix** (linear sRGB → linear P3):
|
|
28
|
-
```
|
|
29
|
-
R_p3 = 0.82246197 * R_srgb + 0.17753803 * G_srgb
|
|
30
|
-
G_p3 = 0.03319420 * R_srgb + 0.96680580 * G_srgb
|
|
31
|
-
B_p3 = 0.01708263 * R_srgb + 0.07239744 * G_srgb + 0.91051993 * B_srgb
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### 2. Gamut Enhancement
|
|
35
|
-
|
|
36
|
-
After P3 conversion, colors are enhanced to push into the wider gamut:
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
// 1. Convert to HSL for easier manipulation
|
|
40
|
-
const [h, s, l] = rgbToHsl(r, g, b)
|
|
41
|
-
|
|
42
|
-
// 2. Skip neutrals (grays, near-blacks/whites)
|
|
43
|
-
if (s < 0.1 || l < 0.1 || l > 0.9) return [r, g, b]
|
|
44
|
-
|
|
45
|
-
// 3. Boost saturation (15-30% based on original)
|
|
46
|
-
const saturationBoost = 0.15 + (s * 0.15)
|
|
47
|
-
const newS = Math.min(1.0, s + (s * saturationBoost))
|
|
48
|
-
|
|
49
|
-
// 4. Boost luminance for vibrant colors (5%)
|
|
50
|
-
let newL = l
|
|
51
|
-
if (s > 0.5 && l < 0.7) {
|
|
52
|
-
newL = Math.min(0.9, l + (l * 0.05))
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// 5. Convert back to RGB → format as CSS
|
|
56
|
-
return `color(display-p3 ${r} ${g} ${b})`
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
This enhancement pushes colors into P3 gamut regions not accessible in sRGB, making them noticeably more vibrant on compatible displays.
|
|
60
|
-
|
|
61
|
-
## Color Examples
|
|
62
|
-
|
|
63
|
-
| Color | sRGB (Standard) | Display P3 (Vibrant) | Notes |
|
|
64
|
-
|--------|-----------------|----------------------|-------|
|
|
65
|
-
| Blue | `#008cff` | `color(display-p3 0.267653 0.570512 1.000000)` | Maxed blue channel |
|
|
66
|
-
| Red | `#ff2e3f` | `color(display-p3 1.000000 0.250216 0.262337)` | Maxed red channel |
|
|
67
|
-
| Purple | `#c635e4` | `color(display-p3 0.770871 0.230698 0.945253)` | Highly saturated |
|
|
68
|
-
| Green | `#0dbe4e` | `color(display-p3 0.298067 0.776115 0.322484)` | Enhanced saturation |
|
|
69
|
-
| Cyan | `#08c0ef` | `color(display-p3 0.327292 0.790977 0.995660)` | Nearly maxed blue |
|
|
70
|
-
|
|
71
|
-
## Usage with Shiki
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npm i @pierre/vscode-theme
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
```typescript
|
|
78
|
-
import { createHighlighter } from 'shiki'
|
|
79
|
-
import pierreDarkVibrant from 'pierre-vscode-theme/themes/pierre-dark-vibrant.json'
|
|
80
|
-
|
|
81
|
-
const highlighter = await createHighlighter({
|
|
82
|
-
themes: [pierreDarkVibrant],
|
|
83
|
-
langs: ['typescript', 'javascript']
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
const html = highlighter.codeToHtml(code, {
|
|
87
|
-
lang: 'typescript',
|
|
88
|
-
theme: 'Pierre Dark Vibrant'
|
|
89
|
-
})
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Relevant files
|
|
93
|
-
|
|
94
|
-
- **`src/color-p3.ts`** - Color conversion and enhancement
|
|
95
|
-
- **`src/demo-p3.ts`** - Demo showing conversions (`npx ts-node src/demo-p3.ts`)
|
|
96
|
-
- **`color-comparison.html`** - Visual comparison tool (open in Safari on P3 display)
|
|
97
|
-
|
|
98
|
-
## Testing
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
# View color conversions
|
|
102
|
-
npx ts-node src/demo-p3.ts
|
|
103
|
-
|
|
104
|
-
# Rebuild themes
|
|
105
|
-
npm run build
|
|
106
|
-
|
|
107
|
-
# Run tests
|
|
108
|
-
npm test
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Why this matters
|
|
112
|
-
|
|
113
|
-
Unlike typical P3 conversions that just transform color space mathematically, this implementation:
|
|
114
|
-
|
|
115
|
-
1. **Actually uses the wider gamut** - Pushes colors beyond sRGB constraints
|
|
116
|
-
2. **Intelligently enhances** - Only boosts saturated colors, preserves neutrals
|
|
117
|
-
3. **Maintains accuracy** - Grays, blacks, whites stay true
|
|
118
|
-
4. **Degrades gracefully** - Automatic fallback for non-P3 browsers
|
|
119
|
-
|
|
120
|
-
This makes the themes truly take advantage of modern display technology on compatible hardware.
|
package/src/build.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
// src/build.ts
|
|
2
|
-
import { writeFileSync, mkdirSync } from "node:fs";
|
|
3
|
-
import { light as rolesLight, dark as rolesDark } from "./palette";
|
|
4
|
-
import { makeTheme } from "./theme";
|
|
5
|
-
import { makeZedThemeFamily } from "./zed-theme";
|
|
6
|
-
import { convertRolesToP3 } from "./color-p3";
|
|
7
|
-
|
|
8
|
-
mkdirSync("themes", { recursive: true });
|
|
9
|
-
mkdirSync("zed/themes", { recursive: true });
|
|
10
|
-
|
|
11
|
-
// Convert palettes to Display P3 color space
|
|
12
|
-
const rolesLightP3 = convertRolesToP3(rolesLight);
|
|
13
|
-
const rolesDarkP3 = convertRolesToP3(rolesDark);
|
|
14
|
-
|
|
15
|
-
// ============================================
|
|
16
|
-
// VS Code Themes
|
|
17
|
-
// ============================================
|
|
18
|
-
const vscodeThemes = [
|
|
19
|
-
{ file: "themes/pierre-light.json", theme: makeTheme("Pierre Light", "light", rolesLight) },
|
|
20
|
-
{ file: "themes/pierre-dark.json", theme: makeTheme("Pierre Dark", "dark", rolesDark) },
|
|
21
|
-
{ file: "themes/pierre-light-vibrant.json", theme: makeTheme("Pierre Light Vibrant", "light", rolesLightP3) },
|
|
22
|
-
{ file: "themes/pierre-dark-vibrant.json", theme: makeTheme("Pierre Dark Vibrant", "dark", rolesDarkP3) }
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
for (const {file, theme} of vscodeThemes) {
|
|
26
|
-
writeFileSync(file, JSON.stringify(theme, null, 2), "utf8");
|
|
27
|
-
console.log("Wrote", file);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// ============================================
|
|
31
|
-
// Zed Theme Family
|
|
32
|
-
// ============================================
|
|
33
|
-
const zedTheme = makeZedThemeFamily("Pierre", "pierrecomputer", [
|
|
34
|
-
{ name: "Pierre Light", appearance: "light", roles: rolesLight },
|
|
35
|
-
{ name: "Pierre Dark", appearance: "dark", roles: rolesDark },
|
|
36
|
-
]);
|
|
37
|
-
|
|
38
|
-
writeFileSync("zed/themes/pierre.json", JSON.stringify(zedTheme, null, 2), "utf8");
|
|
39
|
-
console.log("Wrote zed/themes/pierre.json");
|
|
40
|
-
|
|
41
|
-
// ============================================
|
|
42
|
-
// ESM wrapper modules (for npm / Shiki consumers)
|
|
43
|
-
// ============================================
|
|
44
|
-
mkdirSync("dist", { recursive: true });
|
|
45
|
-
|
|
46
|
-
const themeNames: string[] = [];
|
|
47
|
-
|
|
48
|
-
for (const { file, theme } of vscodeThemes) {
|
|
49
|
-
const name = file.replace("themes/", "").replace(".json", "");
|
|
50
|
-
themeNames.push(name);
|
|
51
|
-
const json = JSON.stringify(theme);
|
|
52
|
-
const escaped = json.replace(/\\/g, "\\\\").replace(/'/g, "\\'");
|
|
53
|
-
const mjs = `export default Object.freeze(JSON.parse('${escaped}'))\n`;
|
|
54
|
-
writeFileSync(`dist/${name}.mjs`, mjs, "utf8");
|
|
55
|
-
console.log("Wrote", `dist/${name}.mjs`);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const indexMjs = `export const themeNames = ${JSON.stringify(themeNames)}\n`;
|
|
59
|
-
writeFileSync("dist/index.mjs", indexMjs, "utf8");
|
|
60
|
-
console.log("Wrote dist/index.mjs");
|