# `themecode`: Adapt, Generate, and Check Editor Themes ```{py:currentmodule} irix.themecode ``` `themecode` is a semi-latent tool: every operation is pure, offline, and deterministic -- no network access, no LM calls. Where adaptation is ambiguous (a color has no classifiable role and no near palette match), the tool does not guess silently: it falls back to the nearest perceptual swatch and surfaces the decision in the report (verdict `fallback`, plus the unclassified-role list) for a human to review. Subcommands: - `themecode adapt ` -- port a foreign theme (Sublime `.sublime-color-scheme`, VSCode JSON, kimi-code JSON) onto the Irix palette. Each color usage walks the decision ladder: **exact** (already an Irix swatch, kept byte-identical) -> **near** (within the OKLab `--threshold`, snapped) -> **semantic** (role classified, replaced from the `irix.data/semantics.yaml` canon, rung-class-guarded so a surface/border-rung swatch never lands in a foreground slot) -> **fallback** (nearest swatch by `delta_e_ok`). Rewrites are textual and structure-preserving (see [](schemes.md)). - `themecode generate ` -- emit an Irix-native theme for a new app (`vscode`, `kimi`) from the semantics canon. Adding a target is one function plus a `GENERATORS` entry. - `themecode check ` -- static validation: parseability, hex validity, Irix coverage (share of colors that are exact swatches), and contrast floors. ```{eval-rst} .. automodule:: irix.themecode :members: ```