codex-theme-switcher
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSwitch the active Codex theme
切换Codex激活主题
Apply a theme from the managed local library to the running Codex desktop app, switch between installed themes, restore the native look, and verify what is actually active. This skill is standalone: its TypeScript scripts own the reversible injection runtime. It does not create or edit themes (codex-theme-creator), install them from the gallery (codex-theme-installer), or publish them (codex-theme-submitter). The only required local tools are Node.js 20+, , and the official Codex desktop app.
~/.codexthemes/themes/<theme-id>/npxRun all commands from the installed skill directory. The runtime injects only an owned element over Codex's loopback-only debugging endpoint; it never modifies the signed app bundle, and it themes every open Codex page, not just one window.
<style>从托管的本地库中为运行中的Codex桌面应用应用主题、在已安装主题间切换、恢复原生外观,并验证当前实际激活的主题。此Skill为独立工具:其TypeScript脚本拥有可逆注入运行时。它不创建或编辑主题(该功能由codex-theme-creator负责)、不从主题库安装主题(该功能由codex-theme-installer负责),也不发布主题(该功能由codex-theme-submitter负责)。仅需本地安装Node.js 20+、以及官方Codex桌面应用。
~/.codexthemes/themes/<theme-id>/npx所有命令均需在已安装的Skill目录下运行。运行时仅通过Codex的仅环回调试端点注入自有元素;它绝不会修改已签名的应用包,并且会为所有打开的Codex页面设置主题,而非仅单个窗口。
<style>Step 1: pick the theme
步骤1:选择主题
bash
npx tsx scripts/switch-theme.ts listLists every installed theme (id, name, layout mode) and which one is currently active. Themes arrive in the library from codex-theme-creator (created locally) or codex-theme-installer (downloaded from codexthemes.ai). If the theme the user wants is not listed, hand off to those skills instead of guessing paths.
bash
npx tsx scripts/switch-theme.ts list列出所有已安装的主题(ID、名称、布局模式)以及当前激活的主题。主题可通过codex-theme-creator(本地创建)或codex-theme-installer(从codexthemes.ai下载)添加至库中。如果用户需要的主题未列出,请引导至对应Skill处理,而非自行猜测路径。
Step 2: apply or switch
步骤2:应用或切换主题
bash
npx tsx scripts/switch-theme.ts apply <theme-id>- If Codex is already exposing its debugging endpoint (it is after any previous themed launch), this hot-swaps the theme in place on every open page — no restart, output .
{"status": "active", "pagesThemed": n} - If there is no endpoint (first apply of this app session, or Codex was fully quit), ask the user for explicit permission to restart Codex, then rerun with :
--launch
bash
npx tsx scripts/switch-theme.ts apply <theme-id> --launch--launch{"status": "scheduled"}The launcher supports macOS and Windows. On Windows it finds the Codex/ChatGPT executable (running process path, , or the WindowsApps execution alias — pass with the full path if detection fails), closes it gracefully with (never ), and relaunches it with the debugging flags. If the endpoint never appears after the relaunch, that installed build (for example a Microsoft Store package) drops the debugging flags — report that limitation plainly; never modify files under or the installation directory.
%LOCALAPPDATA%\Programs\...--app.exetaskkill/FWindowsAppsbash
npx tsx scripts/switch-theme.ts apply <theme-id>- 如果Codex已暴露其调试端点(在之前任何一次主题化启动后都会开启),此命令将在所有打开的页面上热切换主题——无需重启,输出。
{"status": "active", "pagesThemed": n} - 如果未检测到端点(为本应用会话首次应用主题,或Codex已完全退出),请先征得用户明确许可后重启Codex,再添加参数重新运行:
--launch
bash
npx tsx scripts/switch-theme.ts apply <theme-id> --launch--launch{"status": "scheduled"}启动器支持macOS和Windows系统。在Windows上,它会查找Codex/ChatGPT可执行文件(运行进程路径、或WindowsApps执行别名——如果检测失败,可通过参数传入完整的路径),使用优雅关闭应用(绝不要使用参数),并携带调试标志重新启动。如果重启后仍未出现端点,说明该已安装版本(例如Microsoft Store包)会丢弃调试标志——请直接告知用户此限制;绝不要修改WindowsApps或安装目录下的文件。
%LOCALAPPDATA%\Programs\...--app.exetaskkill/FBuilt-in readability gate
内置可读性检测机制
Every apply measures the real rendered pixels after injection (screenshot-based contrast of visible text). If the theme leaves text unreadable, the apply automatically reverts to the previously active theme (or the native look) and reports with the measured evidence. Tell the user the theme is broken as shipped and offer to fix it with codex-theme-creator; pass only when the user explicitly says they want to keep the unreadable theme anyway.
{"status": "reverted", "failures": [...]}--force每次应用主题后,都会通过截图测量注入后实际渲染像素的可见文本对比度。如果主题导致文本无法阅读,应用操作会自动恢复到之前激活的主题(或原生外观),并输出及测量依据。请告知用户该主题存在问题,并提供codex-theme-creator工具以修复;仅当用户明确表示希望保留该不可读主题时,才使用参数。
{"status": "reverted", "failures": [...]}--forceStep 3: verify — scheduled
is not success
scheduled步骤3:验证——“scheduled”不等于成功
bash
npx tsx scripts/switch-theme.ts statusstatusactivepartialinactivestatusactiveinactive--launch~/.codexthemes/state/launch.logIf an old theme keeps coming back after a successful hot swap (a stale session from an earlier task is still re-injecting it, and its registrations cannot be removed from outside that session), get the user's restart permission and force a clean relaunch — never ask the user to quit the app by hand:
bash
npx tsx scripts/switch-theme.ts apply <theme-id> --launch --relaunch--relaunchscheduledstatusbash
npx tsx scripts/switch-theme.ts statusstatusactivepartialinactivestatusactive--launchinactive~/.codexthemes/state/launch.log如果旧主题在成功热切换后反复出现(早期任务的陈旧会话仍在重新注入该主题,且无法从外部移除其注册信息),请征得用户许可后强制干净重启——绝不要让用户手动退出应用:
bash
npx tsx scripts/switch-theme.ts apply <theme-id> --launch --relaunch--relaunchscheduledstatusStep 4: always hand the user the escape hatch
步骤4:始终为用户提供退出方案
Every successful apply report must also state the background scope from the output, so the user is never surprised that artwork is home-only. Relay in plain language, for example: "Background artwork shows on the home page only; the colors apply on every page. To show it on conversation pages too, ask codex-theme-creator to rebuild with backgroundScope: workspace." Then end with the undo hints, for example: "Reply to return to the theme you had before, or for the native Codex look — fully quitting Codex also removes the theme." A user who dislikes the result must never have to ask how to undo it or how to change the scope.
activebackgroundScopeNoterollbackrestoreEvery apply records the previously active theme. When the user replies (or says the new theme is broken, ugly, or not what they wanted):
rollbackbash
npx tsx scripts/switch-theme.ts rollbackThis re-applies the previously active theme, or restores the native look when there is none. It runs through the same apply pipeline, so the readability gate and verification still apply. (A theme that fails the readability gate never needs a manual rollback — the apply auto-reverts on its own.)
statusWhen the user asks for the native look instead (or replies ):
restorebash
npx tsx scripts/switch-theme.ts restoreRemoves the injected style and page markers from every page and clears the runtime state — no restart needed. A full application quit also drops the theme; reapply with when the user wants it back. If the theme keeps reappearing after restore, a stale session is re-injecting it — use the flow from Step 2 with the user's permission, or have them fully quit and reopen Codex.
--launch--launch --relaunch每次成功应用主题后,必须同时告知用户输出中的背景范围信息,避免用户对主题仅在主页显示感到意外。请用通俗易懂的语言传达,例如:“背景图仅在主页显示;颜色会应用于所有页面。若要在对话页面也显示背景图,请使用codex-theme-creator重新构建并设置backgroundScope: workspace。” 然后提供撤销提示,例如:“回复可恢复到之前的主题,或回复恢复Codex原生外观——完全退出Codex也会移除当前主题。” 用户若不满意结果,绝不需要询问如何撤销或更改范围。
activebackgroundScopeNoterollbackrestore每次应用主题都会记录之前激活的主题。当用户回复(或表示新主题存在问题、难看或不符合预期)时:
rollbackbash
npx tsx scripts/switch-theme.ts rollback此命令会重新应用之前激活的主题;如果没有之前的主题,则恢复原生外观。它会遵循相同的应用流程,因此可读性检测和验证仍然适用。(未通过可读性检测的主题无需手动回滚——应用操作会自动恢复。)
status当用户请求恢复原生外观(或回复)时:
restorebash
npx tsx scripts/switch-theme.ts restore移除所有页面中注入的样式和页面标记,并清除运行时状态——无需重启。完全退出应用也会移除主题;用户如需重新应用,可使用参数。如果恢复后主题仍反复出现,说明存在陈旧会话在重新注入主题——请在征得用户许可后使用步骤2中的流程,或让用户完全退出并重新打开Codex。
--launch--launch --relaunchBoundaries
边界限制
- Ask before any restart; a hot swap needs no permission beyond the user's request to switch.
- Never claim a theme is active based on output alone when a restart was involved — verify with
apply.status - Never modify , the signed application bundle, user tasks, or authentication data.
app.asar - Do not edit theme sources here; route design changes to codex-theme-creator.
- 任何重启操作前均需征得用户同意;热切换仅需用户提出切换请求即可,无需额外许可。
- 当涉及重启时,绝不要仅根据的输出就声称主题已激活——必须通过
apply验证。status - 绝不要修改、已签名的应用包、用户任务或认证数据。
app.asar - 请勿在此编辑主题源文件;如需修改设计,请引导至codex-theme-creator。