Link Search Menu Expand Document (external link)

Customization

Table of contents

  1. Color schemes
  2. Custom schemes
    1. Define a custom scheme
    2. Use a custom scheme
    3. Switchable custom scheme
  3. Override and completely custom styles
  4. Override includes
    1. Custom Footer
    2. Custom Head
      1. Example
    3. Custom Header
    4. Custom Nav Footer

Color schemes

New

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

# Color scheme supports "light" (default) and "dark"
color_scheme: dark

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.

Available variables are listed in the _variables.scss file.

For example, to change the link color from the purple default to blue, include the following inside your scheme file:

Example

$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:

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:

---
---
{% include css/just-the-docs.scss.liquid color_scheme="foo" %}

This allows you to switch the scheme via the following javascript.

jtd.setTheme("foo")

Override and completely custom styles

For styles that aren’t defined as 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.

For example, if you’d like to add your own styles for printing a page, you could add the following styles.

Example

// Print-only styles.
@media print {
  .side-bar,
  .page-header {
    display: none;
  }
  .main-content {
    max-width: auto;
    margin: 1em;
  }
}

Override includes

The site can be modified by overriding any of the custom Jekyll includes provided by default in the theme.

To do this, create an _includes directory and make a copy of the specific file you wish to modify. Any content added to this file will override the theme defaults. You can learn more about this process in the Jekyll docs for Overriding theme defaults.

The following includes were made available to you:

_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.

Custom Head

_includes/head_custom.html

Any HTML added to this file will be inserted before the closing <head> tag. This might include additional <meta>, <link>, or <script> tags.

Example

To add a custom favicon, create _includes/head_custom.html and add:

<link rel="shortcut icon" type="image/png" href="/path/to/your/favicon.png">

Custom Header

_includes/header_custom.html

Content added to this file appears at the top of every page’s main content between the site search and auxiliary links if they are enabled. If search_enabled were set to false and aux_links were removed, the content of header_custom.html would occupy the space at the top of every page.

_includes/nav_footer_custom.html

Any content added to this file will appear at the bottom left of the page below the site’s navigation. By default an attribution to Just the Docs is displayed which reads, This site uses Just the Docs, a documentation theme for Jekyll..