Skip to content

Commit

Permalink
feat: set theme option automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianWowra committed Aug 8, 2024
1 parent 973f75d commit 9b31414
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ yarn add typedoc-github-theme
**Use the theme when generating your documentation:**

```text
typedoc src/** */ --plugin typedoc-github-theme --theme typedoc-github-theme
npx typedoc src --plugin typedoc-github-theme
```

> [!NOTE]
> This plugin fills the following options if they have not been defined by the user:
> [`theme`](https://typedoc.org/options/output/#theme), [`lightHighlightTheme`](https://typedoc.org/options/output/#lighthighlighttheme), [`darkHighlightTheme`](https://typedoc.org/options/output/#darkhighlighttheme)
---

## Author
Expand Down
10 changes: 10 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@ import { GitHubTheme } from './GitHubTheme';
*/
export function load(app: Application) {
app.renderer.defineTheme('typedoc-github-theme', GitHubTheme);

app.on('bootstrapEnd', () => {
if (app.options.isSet('theme') && app.options.getValue('theme') !== 'typedoc-github-theme') {
return app.logger.warn(
`The theme'typedoc-github-theme' is not used because another theme (${app.options.getValue('theme')}) was specified!`
);
}

app.options.setValue('theme', 'typedoc-github-theme');
});
}

0 comments on commit 9b31414

Please sign in to comment.