Repository navigation
feat(web): support a dark scheme and capture light and dark Gate 3 pairs - #8
Conversation
|
Ingrid Larsen · reviewer
|
|
Noah Williams · author Nothing, as far as the script can tell: the 就脚本所能判断的范围而言,什么都不会留下:只要 |
|
Ingrid Larsen · reviewer Why make the light colours variables if dark mode doesn't override them? 既然深色模式并不覆盖指示灯颜色,为什么还要把它们改成变量? |
|
Mateo Rossi · author So every colour in the stylesheet comes from the theme block. The bulbs look the same in both schemes today; if one needs to change, it is a single variable. 这样样式表里的每个颜色都来自主题定义。目前两种主题下灯的颜色一样,以后要改也只需改一个变量。 |
Why
Operators use the page in both light and dark system themes, so the page needs a dark scheme that still passes accessibility checks, and the documentation screenshots need a matching pair for each scene.
What changed
web/src/style.css: move every colour into variables on:root, setcolor-scheme: light dark, and override them underprefers-color-scheme: dark. A later commit also moves the green, red and network light colours into--green-light,--red-lightand--net-light; they are the same in both schemes.web/src/main.tsx: the turnstile arm isaria-hiddenand theLocked/Walk throughtext sits in its ownturnstile-labelstrip, so it stays readable over the arm. A disabled turnstile keeps full opacity.e2e/entrance.spec.tsruns the scan-and-axe check once forlightand once fordark.playwright.config.tssetsdeviceScaleFactor: 2.e2e/screenshot-pair.ts:screenshotPair(page, name)scrolls to the top and writes<name>.pngand<name>.dark.pngwith animations disabled.real-gate3-stopped.spec.tsuses it.scripts/screenshots.sh: givenGATEPOST_DIR,GATE3_WORKING_REFandGATE3_CRASH_REF, it prints both revisions, builds the crash revision in a temporary worktree, starts the entrance with--gate3-crash, runs the Gate 3 spec, shuts everything down, and fails if anygatepost-sim-devicescontainer remains. A trap cleans up on failure.docs/screenshots/gate3-stopped.pngwith the 2× light capture, addgate3-stopped.dark.png, and document the pairs and the script in both READMEs and both screenshot READMEs.How to verify
Both
fake gates scan and meet axe checks in lightand... in darkshould run. To retake the pair, with Docker and a Gatepost checkout:背景
运维人员的系统主题有浅色也有深色,所以页面需要一套同样能通过无障碍检查的深色配色;文档截图也要为每个场景各准备一对浅色和深色图。
改动
web/src/style.css:所有颜色都改为:root上的变量,设置color-scheme: light dark,并在prefers-color-scheme: dark下覆盖这些变量。随后的一个提交又把绿灯、红灯和网络灯的颜色移到--green-light、--red-light和--net-light,这三个颜色在两种主题下相同。web/src/main.tsx:转闸横杆设为aria-hidden,Locked/Walk through文字放进单独的turnstile-label条,不会被横杆挡住;禁用状态的转闸保持不透明。e2e/entrance.spec.ts分别以light和dark各跑一次扫码加 axe 检查。playwright.config.ts设置deviceScaleFactor: 2。e2e/screenshot-pair.ts:screenshotPair(page, name)先滚动到顶部,再在关闭动画的情况下写出<name>.png和<name>.dark.png。real-gate3-stopped.spec.ts改用它截图。scripts/screenshots.sh:给定GATEPOST_DIR、GATE3_WORKING_REF和GATE3_CRASH_REF后,先打印两个版本,在临时 worktree 中构建崩溃版本,以--gate3-crash启动入口,运行 Gate 3 用例,然后全部关闭;如果还有gatepost-sim-devices的容器残留就报错。出错时由 trap 负责清理。docs/screenshots/gate3-stopped.png,新增gate3-stopped.dark.png,并在两份 README 和两份截图说明中写明截图对和脚本用法。怎么验证
应同时运行
fake gates scan and meet axe checks in light和... in dark两个用例。要重拍这对截图,需要 Docker 和 Gatepost 检出: