Skip to content

refactor(ui): split built-in theme definitions#354

Merged
benvinegar merged 1 commit into
mainfrom
refactor/split-themes
May 23, 2026
Merged

refactor(ui): split built-in theme definitions#354
benvinegar merged 1 commit into
mainfrom
refactor/split-themes

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • Move built-in theme definitions into per-theme modules under src/ui/themes/
  • Keep src/ui/themes.ts as the public theme registry and resolver
  • Add concise AGENTS guidance for future built-in theme additions

Verification

  • bun run typecheck
  • bun run lint
  • bun test

This PR description was generated by Pi using OpenAI GPT-5 Codex

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 23, 2026

Greptile Summary

This PR is a pure structural refactor that splits the monolithic src/ui/themes.ts into per-theme modules under src/ui/themes/, with shared types and syntax helpers in types.ts and syntax.ts. No theme logic, color values, or THEMES array ordering was changed.

  • New modules: types.ts (shared interfaces), syntax.ts (withLazySyntaxStyle/createSyntaxStyle), and one file per built-in theme (graphite, midnight, paper, ember, catppuccin).
  • themes.ts reduced to an aggregator: imports per-theme constants, re-exports CATPPUCCIN_PALETTES and public types for backward compatibility.
  • AGENTS.md updated: adds guidance for future theme authors (where to add files, what else needs updating, palette/semantic separation).

Confidence Score: 5/5

Safe to merge — this is a mechanical code split with no logic changes, identical color values, and preserved THEMES ordering.

Every theme definition is moved verbatim, the lazy syntaxStyle getter behavior is unchanged, THEMES order is preserved, and public re-exports from themes.ts maintain backward compatibility. The only surface-area additions are that ThemeBase, SyntaxColors, createCatppuccinTheme, createSyntaxStyle, and withLazySyntaxStyle are now exported where they were previously private — an acceptable side effect of the split.

No files require special attention.

Important Files Changed

Filename Overview
src/ui/themes/types.ts New file extracting AppTheme, SyntaxColors, and ThemeBase type definitions from the monolithic themes.ts; pure type movement, no logic changes.
src/ui/themes/syntax.ts New file extracting createSyntaxStyle and withLazySyntaxStyle helpers; both are now exported (were private in themes.ts) but the lazy-getter behavior is preserved identically.
src/ui/themes/catppuccin.ts New file extracting Catppuccin palette and theme factory; createCatppuccinTheme is now exported (was private), and the two built-in instances are eagerly created as module-level constants — semantically identical to their inline placement in the old THEMES array.
src/ui/themes.ts Reduced to an aggregator: imports individual theme constants, declares THEMES in the same order as before, re-exports CATPPUCCIN_PALETTES and the public types; no functional changes to resolveTheme/availableThemes/buildCustomTheme.
src/ui/themes/ember.ts Ember theme definition extracted verbatim from the inline THEMES array; all color values and structure are identical to the removed code.
src/ui/themes/graphite.ts Graphite theme definition extracted verbatim; no behavioral changes.
src/ui/themes/midnight.ts Midnight theme definition extracted verbatim; no behavioral changes.
src/ui/themes/paper.ts Paper theme definition extracted verbatim; no behavioral changes.
AGENTS.md Adds concise guidance for adding or renaming built-in themes, referencing the new per-theme module convention.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[src/ui/themes.ts\npublic registry & resolver] --> B[themes/types.ts\nAppTheme · SyntaxColors · ThemeBase]
    A --> C[themes/syntax.ts\ncreate/withLazySyntaxStyle]
    A --> D[themes/graphite.ts\nGRAPHITE_THEME]
    A --> E[themes/midnight.ts\nMIDNIGHT_THEME]
    A --> F[themes/paper.ts\nPAPER_THEME]
    A --> G[themes/ember.ts\nEMBER_THEME]
    A --> H[themes/catppuccin.ts\nCATTPPUCCIN_LATTE/MOCHA_THEME]
    C --> B
    D --> C
    D --> B
    E --> C
    E --> B
    F --> C
    F --> B
    G --> C
    G --> B
    H --> C
    H --> B
Loading

Reviews (1): Last reviewed commit: "refactor(ui): split built-in theme defin..." | Re-trigger Greptile

@benvinegar benvinegar merged commit fa75467 into main May 23, 2026
7 of 8 checks passed
@benvinegar benvinegar deleted the refactor/split-themes branch May 23, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant