Skip to content

Commit 72bc18b

Browse files
Merge pull request #11 from claytercek/main
Generate themes from primer design system, add accessible themes
2 parents 2245316 + 40772d5 commit 72bc18b

11 files changed

Lines changed: 3627 additions & 395 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
node_modules/
3+
package-lock.json

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,17 @@ Project inspired on [GitHub's VS Code theme](https://github.com/primer/github-vs
2121
## Contributing
2222

2323
Feel free to fork, make changes, and submit a pull request.
24+
25+
## Development
26+
27+
```bash
28+
npm install
29+
npm run dev
30+
```
31+
32+
## Publishing new versions
33+
34+
1. Update the version in `extension.toml`
35+
2. Run `npm run build`
36+
3. Commit and push your changes (make sure to push the built files in `themes/` as well)
37+
4. Follow the [Zed publishing docs](https://zed.dev/docs/extensions/developing-extensions#updating-an-extension) to publish the extension

extension.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

extension.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
id = "github-theme"
2+
name = "Github Theme"
3+
version = "0.0.3"
4+
schema_version = 1
5+
authors = ["Pyae Sone Aung <pyaesoneaungrgn@gmail.com>", "Clay Tercek"]
6+
description = "GitHub themes for Zed"
7+
repository = "https://github.com/PyaeSoneAungRgn/github-zed-theme"

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "github-zed-theme-generator",
3+
"version": "0.0.1",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "node --watch src/generate",
8+
"build": "node src/generate"
9+
},
10+
"devDependencies": {
11+
"@primer/primitives": "^9.1.1",
12+
"@types/node": "^20.14.6",
13+
"typescript": "^5.4.5"
14+
}
15+
}

src/generate.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import fs from 'node:fs/promises'
2+
import { getTheme } from './theme.js'
3+
4+
const writeData = {
5+
"$schema": "https://zed.dev/schema/themes/v0.1.0.json",
6+
"name": "Github Theme",
7+
"author": "Pyae Sone Aung",
8+
"themes": [
9+
getTheme({ themeKey: 'light', name: "Github Light", type: 'light' }),
10+
getTheme({ themeKey: 'light_colorblind', name: "Github Light Colorblind", type: 'light' }),
11+
getTheme({ themeKey: 'light_high_contrast', name: "Github Light High Contrast", type: 'light' }),
12+
getTheme({ themeKey: 'light_tritanopia', name: "Github Light Tritanopia", type: 'light' }),
13+
getTheme({ themeKey: 'dark', name: "Github Dark", type: 'dark' }),
14+
getTheme({ themeKey: 'dark_colorblind', name: "Github Dark Colorblind", type: 'dark' }),
15+
getTheme({ themeKey: 'dark_high_contrast', name: "Github Dark High Contrast", type: 'dark' }),
16+
getTheme({ themeKey: 'dark_tritanopia', name: "Github Dark Tritanopia", type: 'dark' }),
17+
getTheme({ themeKey: 'dark_dimmed', name: "Github Dark Dimmed", type: 'dark' }),
18+
]
19+
}
20+
21+
await fs.mkdir('./themes', { recursive: true })
22+
23+
await fs.writeFile('./themes/github_theme.json', JSON.stringify(writeData, null, 2))

src/global.d.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
type Token = {
3+
name: string
4+
} & (
5+
| { type: 'COLOR'; value: { r: number; g: number; b: number; a: number } }
6+
| { type: 'FLOAT'; value: number }
7+
);
8+
9+
declare module '@primer/primitives/dist/figma/themes/*.json' {
10+
type Theme = Token[];
11+
12+
const theme: Theme;
13+
14+
export default theme;
15+
}
16+
17+
declare module '@primer/primitives/dist/figma/scales/*.json' {
18+
type Scale = Token[];
19+
20+
const scale: Scale;
21+
22+
export default scale;
23+
}

0 commit comments

Comments
 (0)