oscli

Theme

Use presets for fast defaults or override only the parts you want.

The theme system is shallow to use and deep enough to be practical. Use a preset name when you want a fast default. Use a theme object when you only need to override a few colors or symbols.

Presets

These are the built-in presets.

src/cli.ts
export const cli = createCLI(() => ({
  description: "default theme",
  theme: "default",
}));
src/cli.ts
export const cli = createCLI(() => ({
  description: "basic theme",
  theme: "basic",
}));
src/cli.ts
export const cli = createCLI(() => ({
  description: "rounded theme",
  theme: "rounded",
}));
  • default: square corners, rail, spacing 1
  • basic: no corners, no rail, spacing 0, cyan cursor and active state
  • rounded: and corners, pipe rail, spacing 1

Preset previews

These examples show the overall layout difference, not the full color treatment.

default
  project setup

 Project:   my-app

  Done.
basic
  project setup
 Project:   my-app
  Done.
rounded
  project setup

 Project:   my-app

  Done.

Theme overrides

Use ThemeOverride when you want to change only a few fields.

src/cli.ts
export const cli = createCLI((b) => ({
  description: "themed tool",
  theme: {
    active: "cyan",
    success: "green",
    symbols: {
      cursor: "❯",
      success: "✔",
    },
    spacing: 0,
  },
  prompts: {
    project: b.text().label("Project"),
  },
}));

Prop

Type

Per-prompt color

Use .color() when you want one prompt label to stand out without changing the rest of the theme.

src/cli.ts
export const cli = createCLI((b) => ({
  description: "prompt colors",
  prompts: {
    project: b.text().label("Project").color("cyan"),
    owner: b.text().label("Owner").color("yellow"),
  },
}));

These are the accepted color names.

Prop

Type

Presets are only shortcuts. Internally, they resolve to the same ThemeOverride shape you can pass manually.

On this page