--- title: Customization nav_order: 6 --- # Customization {: .no_toc } ## Table of contents {: .no_toc .text-delta } 1. TOC {:toc} --- ## Color schemes Just the Docs supports two color schemes: light (default), and dark. To enable a color scheme, set the `color_scheme` parameter in your site's `_config.yml` file: ### Example: preview dark color scheme {: .no_toc .text-delta } ```yaml # Color scheme supports "light" (default) and "dark" color_scheme: dark ``` ### deprecated: `legacy_light` {: .d-inline-block .no_toc } New (v0.4.2) {: .label .label-green } In Just the Docs version `0.4.2`, we changed the default syntax highlighting theme for the `light` color scheme to have higher contrast. Users who want to use the old highlighting need to explicitly opt-in with the deprecated `legacy_light` color scheme. In a future major release of Just the Docs, we will remove this color scheme. ## Custom schemes ### Define a custom scheme You can add custom schemes. If you want to add a scheme named `foo` (can be any name) just add a file `_sass/color_schemes/foo.scss` (replace `foo` by your scheme name) where you override theme variables to change colors, fonts, spacing, etc. {: .note } Since the default color scheme is `light`, your custom scheme is implicitly based on the variable settings used by the `light` scheme. If you want your custom scheme to be based on the `dark` scheme, you need to start your file with the following line: ```scss @import "./color_schemes/dark"; ``` You can define custom schemes based on other custom schemes in the same way. Available variables are listed in the [\_variables.scss](https://github.com/just-the-docs/just-the-docs/tree/main/_sass/support/_variables.scss) file. For example, to change the link color from the purple default to blue, include the following inside your scheme file: #### Example: custom link color {: .no_toc .text-delta } ```scss $link-color: $blue-000; ``` Keep in mind that changing a variable will not automatically change the value of other variables that depend on it. For example, the default link color (`$link-color`) is set to `$purple-000`. However, redefining `$purple-000` in a custom color scheme will not automatically change `$link-color` to match it. Instead, each variable that relies on previously-cascaded values must be manually reimplemented by copying the dependent rules from `_variables.scss` — in this case, rewriting `$link-color: $purple-000;`. _Note:_ Editing the variables directly in `_sass/support/variables.scss` is not recommended and can cause other dependencies to fail. Please use scheme files. ### Use a custom scheme To use the custom color scheme, only set the `color_scheme` parameter in your site's `_config.yml` file: ```yaml color_scheme: foo ``` ### Switchable custom scheme If you want to be able to change the scheme dynamically, for example via javascript, just add a file `assets/css/just-the-docs-foo.scss` (replace `foo` by your scheme name) with the following content: {% raw %} --- --- {% include css/just-the-docs.scss.liquid color_scheme="foo" %} {% endraw %} This allows you to switch the scheme via the following javascript. ```js jtd.setTheme("foo") ``` ## Override and define new variables {: .d-inline-block } New (v0.4.0) {: .label .label-green } To define new SCSS variables or functions, place SCSS code in `_sass/custom/setup.scss`. This should *not* be used for defining custom styles (see the next section) or overriding color scheme variables (in this case, you should create a new color scheme). This is most commonly-used to define [custom callout colors]({% link docs/configuration.md %}#callouts). For example, ```scss // _sass/custom/setup.scss $pink-000: #f77ef1; $pink-100: #f967f1; $pink-200: #e94ee1; $pink-300: #dd2cd4; ``` In particular: this file is imported *after* the theme's variables and functions are defined, but *before* any CSS classes are emitted. ## Override and completely custom styles For styles that aren't defined as SCSS variables, you may want to modify specific CSS classes. Additionally, you may want to add completely custom CSS specific to your content. To do this, put your styles in the file `_sass/custom/custom.scss`. This will allow for all overrides to be kept in a single file, and for any upstream changes to still be applied. ### Example: custom print styles {: .no_toc .text-delta } For example, if you'd like to add your own styles for printing a page, you could add the following styles. ```scss // Print-only styles. @media print { .side-bar, .page-header { display: none; } .main-content { max-width: auto; margin: 1em; } } ``` ## Override includes You can customize the theme by overriding any of the custom [Jekyll includes](https://jekyllrb.com/docs/includes/) files that it provides. To do this, create an `_includes` directory and make a copy of the specific file you wish to modify. The content in this file will override the theme defaults. You can learn more about this process in the Jekyll docs for [Overriding theme defaults](https://jekyllrb.com/docs/themes/#overriding-theme-defaults). Just the Docs provides the following custom includes files: ### Custom TOC Heading {: .d-inline-block } New (v0.4.0) {: .label .label-green } `_includes/toc_heading_custom.html` If the page has any child pages, and `has_toc` is not set to `false`, this content appears as a heading above the [auto-generating list of child pages]({% link docs/navigation/children.md %}) after the page's content. #### Example: changing TOC heading {: .no_toc } To change the default TOC heading to "Contents", create `_includes/toc_heading_custom.html` and add: ```html

Contents

``` The (optional) `text-delta` class makes the heading appear as **Contents**{:.text-delta} . ### Custom Footer `_includes/footer_custom.html` This content appears at the bottom of every page's main content. More info for this include can be found in the [Configuration - Footer content]({% link docs/configuration.md %}#footer-content). ### Custom Head `_includes/head_custom.html` Any HTML added to this file will be inserted before the closing `` tag. This might include additional ``, ``, or `