Skip to content

Commit

Permalink
chore: update themes docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Nov 20, 2023
1 parent 74514be commit fe71352
Showing 1 changed file with 15 additions and 60 deletions.
75 changes: 15 additions & 60 deletions docs/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,27 @@ oclif supports themes that users can either define for themselves or select from

By default, the theme only applies to help output but you can extend the theme for your own purposes if you want. See [Extending Themes](#extending-themes) section below.

## themes.json
## theme.json

By default oclif will read themes from `~/.config/<CLI>/themes.json`.
By default oclif will read themes from `~/.config/<CLI>/theme.json`.

This file takes the following shape:

```json
{
// the theme that oclif will use. Must correspond to one of the themes under the `themes` property
"selected": "dark"
// the list of themes that the user can choose from
"themes": {
"dark": {
"bin": "white",
"command": "cyan",
"commandSummary": "white",
"dollarSign": "white",
"flag": "white",
"flagDefaultValue": "blue",
"flagOptions": "white",
"flagRequired": "red",
"flagSeparator": "white",
"sectionDescription": "white",
"sectionHeader": "underline",
"topic": "white",
"version": "white"
},
"light": {
"bin": "black",
"command": "cyan",
"commandSummary": "black",
"dollarSign": "black",
"flag": "black",
"flagDefaultValue": "blue",
"flagOptions": "black",
"flagRequired": "red",
"flagSeparator": "black",
"sectionDescription": "black",
"sectionHeader": "underline",
"topic": "black",
"version": "black"
}
}
"bin": "white",
"command": "cyan",
"commandSummary": "white",
"dollarSign": "white",
"flag": "white",
"flagDefaultValue": "blue",
"flagOptions": "white",
"flagRequired": "red",
"flagSeparator": "white",
"sectionDescription": "white",
"sectionHeader": "underline",
"topic": "white",
"version": "white"
}
```

Expand Down Expand Up @@ -78,29 +56,6 @@ The values for each of these must be one of the following:

Any invalid values will be ignored.

## Shipping Themes with Your CLI

If you'd like to ship one or more themes with your CLI you only need to do a couple of things:

In your CLI's package.json you need to point oclif to your themes JSON file and be sure to include the file in the `files` section so that it gets included in the published package:

```json
// package.json
"files": ["themes.json"],
"oclif": {
"themesFile": "themes.json"
}
```

oclif will now read themes from the configured themes files instead of the default `~/.config/<CLI>/themes.json`.

## Managing Themes

Users can manage themes in a couple of different ways.

1. They can modify the themes file directly. If your CLI configures a `themesFile` (as described above) then they will modify that file. If not, then they would need to modify the default `~/.config/<CLI>/themes.json`.
2. They can install `@oclif/plugin-theme` to get a set of commands for managing themes.

## Disabling Themes

Themes can be disabled by using `<CLI>_DISABLE_THEME` environment variable.
Expand Down

0 comments on commit fe71352

Please sign in to comment.