Skip to content

Latest commit

 

History

History
76 lines (55 loc) · 3.26 KB

File metadata and controls

76 lines (55 loc) · 3.26 KB

Theme Build Script

Generates OpenCode built-in theme JSON files from the Xscriptor color palette collection.

Requirements

  • Python 3.7 or later

Usage

Standalone mode (built-in data)

Uses the 12 pre-defined themes compiled into the script:

./generate.py
./generate.py --output ../dist

Parse from colors.md

Reads ANSI color definitions from colors.md and converts them to the full OpenCode semantic theme format with auto-generated dark/light variants:

./generate.py --colors ../../colors.md
./generate.py --colors ../../colors.md --output ../dist

Output

All generated theme JSON files are written to the specified output directory (default: dist/). Each file follows the https://opencode.ai/theme.json schema with:

  • defs - Color definitions with dark and light prefixed references
  • theme - Semantic color mappings with { "dark": "...", "light": "..." } variant objects

Generated Themes

Theme Type Description
xDarkDeep dark with vibrant pink, green, and cyan accents
madridLightClean light with deep red, green, and blue tones
lahabanaDarkDark gray with bright neon accents
miamiDarkTrue black with synthwave-inspired colors
parisDarkPurple-black with pastel cyan and blue
tokioDarkDark gray with balanced warm and cool tones
osloDarkBlue-gray with professional muted palette
helsinkiLightNear-white with earthy, natural tones
berlinDarkBlack with monochrome grayscale palette
londonLightWhite with sophisticated grayscale tones
prahaDarkDark with Dracula-inspired vibrant colors
bogotaDarkMaroon-black with cyan and warm accents

How It Works

  1. Standalone mode: Uses theme data built into the script with pre-designed dark/light variants for each scheme.
  2. colors.md mode: Parses the markdown file, extracts ANSI color tables (color0-color15), and auto-generates full OpenCode themes. Light variants are derived by swapping background/foreground and blending accent colors.
  3. Each theme is written as a separate JSON file in the output directory.

Using the Output

The generated files are ready for submission as built-in themes in the OpenCode repository. Copy them to:

packages/opencode/src/cli/cmd/tui/context/theme/

Then register each theme in theme.tsx by adding an import and an entry in the DEFAULT_THEMES object.