notes/docs/customization.md

72 lines
1.9 KiB
Markdown
Raw Normal View History

2017-03-09 18:16:08 +00:00
---
layout: default
title: Customization
2018-11-16 16:47:14 +00:00
nav_order: 6
2017-03-09 18:16:08 +00:00
---
2017-03-27 01:09:19 +00:00
# Customization
2019-01-14 19:18:09 +00:00
{: .no_toc }
2017-03-27 01:09:19 +00:00
## Table of contents
{: .no_toc .text-delta }
1. TOC
{:toc}
---
2018-11-18 16:07:45 +00:00
## Color schemes
{: .d-inline-block }
2018-11-18 16:07:45 +00:00
New
{: .label .label-green }
2018-11-18 16:07:45 +00:00
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
{: .no_toc }
2018-11-18 16:07:45 +00:00
2019-01-16 01:43:19 +00:00
```yaml
2018-11-18 16:07:45 +00:00
# Color scheme currently only supports "dark" or nil (default)
color_scheme: "dark"
```
<button class="btn js-toggle-dark-mode">Preview dark color scheme</button>
<script>
2019-05-04 20:20:36 +00:00
const toggleDarkMode = document.querySelector('.js-toggle-dark-mode');
const cssFile = document.querySelector('[rel="stylesheet"]');
const originalCssRef = cssFile.getAttribute('href');
const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css');
2018-11-18 16:07:45 +00:00
2019-08-14 14:08:01 +00:00
jtd.addEvent(toggleDarkMode, 'click', function(){
2018-11-18 16:07:45 +00:00
if (cssFile.getAttribute('href') === originalCssRef) {
2019-05-04 20:20:36 +00:00
cssFile.setAttribute('href', darkModeCssRef);
2018-11-18 16:07:45 +00:00
} else {
2019-05-04 20:20:36 +00:00
cssFile.setAttribute('href', originalCssRef);
2018-11-18 16:07:45 +00:00
}
})
</script>
## Specific visual customization
2017-03-27 01:09:19 +00:00
2019-01-14 19:32:41 +00:00
To customize your sites aesthetic, open `_sass/custom/custom.scss` in your editor to see if there is a variable that you can override. Most styles like fonts, colors, spacing, etc. are derived from these variables. To override a specific variable, uncomment its line and change its value.
2017-03-27 01:09:19 +00:00
2019-01-14 19:32:41 +00:00
For example, to change the link color from the purple default to blue, open `_sass/custom/custom.css` and find the `$link-color` variable on line `50`. Uncomment it, and change its value to our `$blue-000` variable, or another shade of your choosing.
2018-11-18 16:07:45 +00:00
#### Example
{: .no_toc }
2017-03-27 01:09:19 +00:00
```scss
// ...
//
// $body-text-color: $grey-dk-100;
// $body-heading-color: $grey-dk-300;
$link-color: $blue-000;
//
// ...
```
2019-01-16 01:43:19 +00:00
_Note:_ Editing the variables directly in `_sass/support/variables.scss` is not recommended and can cause other dependencies to fail.