3.2 KiB
3.2 KiB
02. Convert Existing Themes to JSON Format
meta: id: theme-refactoring-02 feature: theme-refactoring-json-format priority: P0 depends_on: [theme-refactoring-01] tags: [implementation, migration]
objective:
- Convert all existing PodTui themes (catppuccin, gruvbox, tokyo, nord) from TypeScript constants to JSON format
- Ensure each theme matches the opencode JSON structure
- Maintain color fidelity with original theme definitions
deliverables:
src/themes/catppuccin.json- Catppuccin theme in JSON formatsrc/themes/gruvbox.json- Gruvbox theme in JSON formatsrc/themes/tokyo.json- Tokyo Night theme in JSON formatsrc/themes/nord.json- Nord theme in JSON format
steps:
-
Step 2.1: Convert
catppuccintheme fromsrc/types/desktop-theme.tsto JSON- Extract all color definitions from
THEMES_DESKTOP.variants.find((v) => v.name === "catppuccin")!.colors - Create
defsobject with all color references (dark and light variants) - Create
themeobject with semantic mappings - Add
$schemareference - Verify color values match original definitions
- Extract all color definitions from
-
Step 2.2: Convert
gruvboxtheme fromsrc/types/desktop-theme.tsto JSON- Extract all color definitions from
THEMES_DESKTOP.variants.find((v) => v.name === "gruvbox")!.colors - Create
defsobject with all color references - Create
themeobject with semantic mappings - Add
$schemareference
- Extract all color definitions from
-
Step 2.3: Convert
tokyotheme fromsrc/types/desktop-theme.tsto JSON- Extract all color definitions from
THEMES_DESKTOP.variants.find((v) => v.name === "tokyo")!.colors - Create
defsobject with all color references - Create
themeobject with semantic mappings - Add
$schemareference
- Extract all color definitions from
-
Step 2.4: Convert
nordtheme fromsrc/types/desktop-theme.tsto JSON- Extract all color definitions from
THEMES_DESKTOP.variants.find((v) => v.name === "nord")!.colors - Create
defsobject with all color references - Create
themeobject with semantic mappings - Add
$schemareference
- Extract all color definitions from
-
Step 2.5: Verify all JSON files are valid
- Check syntax with
bun run typecheck - Ensure all imports work correctly
- Check syntax with
tests:
-
Unit:
- Test each JSON file can be imported without errors
- Verify color values match original TypeScript definitions
-
Integration/e2e:
- Load each theme and verify all colors are present
- Check that theme structure matches expected schema
acceptance_criteria:
- All four theme JSON files exist in
src/themes/ - Each JSON file follows the theme schema
- Color values match original theme definitions exactly
- All JSON files are valid and can be parsed
validation:
- Run:
bun run typecheck- Should pass - Run:
cat src/themes/catppuccin.json | jq .- Should be valid JSON - Run:
cat src/themes/gruvbox.json | jq .- Should be valid JSON - Run:
cat src/themes/tokyo.json | jq .- Should be valid JSON - Run:
cat src/themes/nord.json | jq .- Should be valid JSON
notes:
- Use opencode's theme structure as reference
- Maintain backward compatibility with existing color definitions
- Ensure both dark and light variants are included if available
- Reference:
/home/mike/code/PodTui/opencode/packages/opencode/src/cli/cmd/tui/context/theme/