* 9b04e7d Merge branch ansi
|\
| * 51cd0aa Add sixteen ANSI colors
|/
* 07be2f1 (origin/main, tag: v1.0) Read palette files
❯ npm run dev
VITE v6.2.0 ready in 412 ms
➜ Local: http://localhost:5173/
10:42:07 INFO GET /api/palettes 200 12 ms
10:42:08 INFO GET /api/themes/kita 200 8 ms
10:42:09 WARN slow query: palettes 812 ms
10:42:10 DEBUG cache hit themes/kita
10:42:11 ERROR POST /api/share 500 41 ms
Error: read ECONNRESET
at TCP.onStreamRead (node:net:216:20)
at share (src/share.ts:48:11)
10:42:12 INFO retry 1/3 in 200 ms
~/code/demo on main +2 ~1
❯ git status -sb
## main...origin/main [ahead 1]
M src/main.rs
?? notes.md
❯ ls
docs src tests Cargo.toml README.md
❯ cargo test
✓ parses config
✗ renders frame expected 3, received 2
❯ colortest
0-7
8-15
❯ echo selected text
theme.ts scenes.ts contrast.ts
1 import { readFile } from 'node:fs/promises'
2 import { type Hex, contrast } from './color.ts'
3
4 /** A palette read from disk and checked against the gate. */
5 ▎ export interface Palette {
6 ▎ name: string
7 ▎ ansi: Hex[]
8 ▎ ratio?: number
9 ▎ }
10
11 const SIXTEEN = 16
12 const FLOOR = 4.5 // WCAG AA for body text
13
14 export async function load(path: string): Promise<Palette> {
15 ▎ const text = await readFile(path, 'utf8')
16 ▎ const colors = parse(text).colors ?? {}
17 if (colors.ansi.length !== SIXTEEN) { ● needs 16 ANSI colors
18 throw new Error('expected sixteen colors, got ' + colors.ansi.length)
19 }
20 ▁ const ratio = contrast(colors.ansi[0], colors.ansi[7]) ● ratio is read once
21 return { name: path, ...colors, ratio: ratio }
22 }
23
24 export function passes(palette: Palette): boolean {
25 return (palette.ratio ?? 0) >= FLOOR // TODO: check the bright pairs
26 }
~
~
~
~
~
NORMAL main src/theme.ts [+] 1 1 utf-8 typescript 21:28 80%
"src/theme.ts" 26L, 912B written
0[|||||||||||||||||| 38.0%] 4[|||||| 12.0%]
1[||||||||||||| 27.0%] 5[||||||||||||||||||||||||| 52.0%]
2[|| 5.0%] 6[| 2.0%]
3[||||||||||||||||||||||||||||||| 64.0%] 7[|||||||||| 22.0%]
Mem[|||||||||||||||||||||||||| 9.84G/16.0G] Tasks: 214, 1093 thr; 4 running
Swp[|||||| 0.31G/2.00G] Load average: 2.14 1.87 1.52
Uptime: 3 days, 04:12:55
PID USER PRI NI VIRT RES S CPU% MEM% TIME+ Command
4127 kec 24 0 412G 612M R 38.2 3.7 3:12.44 node dev.js
2210 kec 31 0 411G 1.2G R 12.0 7.5 1:02.10 /Applications/Ghostty
3301 kec 31 0 409G 12M S 4.4 0.1 0:05.61 zsh
3302 kec 31 0 409G 9.8M S 0.0 0.1 0:00.42 ├─ nvim src/theme.ts
3310 kec 31 0 410G 88M S 1.2 0.5 0:03.18 │ └─ tsserver
3402 kec 24 0 409G 21M R 0.6 0.1 0:01.02 └─ htop
501 kec 31 10 409G 34M S 0.3 0.2 0:02.77 bun test --watch
1180 kec 31 0 409G 72M D 0.0 0.4 0:00.91 rsync -a ~/Pictures backup:
812 root 4 -20 410G 1.5G S 3.1 9.4 0:44.02 kernel_task
167 root 31 0 411G 402M S 0.9 2.5 0:12.80 WindowServer
344 _mdns 31 0 408G 5.1M S 0.0 0.0 0:00.33 mDNSResponder
F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit
hover any text in the window to see its slots · click to pin