How to tweak the look and feel of Typedoc with CSS and custom fonts.
According to the official docs, creating a custom theme requires the default theme assets to be copied on the theme. We’re just interested in how to tweak a few CSS props, so we don’t need the rest of the files (layouts, partials, templates, etc.)
$ mkdir custom-theme
main.css
file from node_modules/typedoc-default-themes/bin/default/assets/css/main.css
and paste it in custom-theme/assets/css/main.css
.Note: The official docs say you need to copy the assets from typedoc-default-themes, but it won’t work and will only download a bunch of sass files.
$ mkdir -p custom-theme/assets/css
$ cp node_modules/typedoc-default-themes/bin/default/assets/css/main.css custom-theme/assets/css
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap');
footer {
display: none;
}
.tsd-page-toolbar {
display: none;
}
.tsd-page-title {
padding-top: 30px;
}
body {
font-family: "Lato", sans-serif;
}
--theme
configuration or edit your config file (typedoc.json
or typedoc.js
):$ typedoc --theme ./custom-theme
Or with typedoc.json
{
"...": "...",
"theme": "./typedoc-theme"
}
RELATED TAGS
CONTRIBUTOR
View all Courses