# Getting started
## Installation
### Installing MkDocs
Before installing [MkDocs][1], you need to make sure you have Python and `pip`
– the Python package manager – up and running. You can verify if you're already
good to go with the following commands:
``` sh
python --version
# Python 2.7.13
pip --version
# pip 9.0.1
```
Installing and verifying MkDocs is as simple as:
``` sh
pip install mkdocs && mkdocs --version
# mkdocs, version 0.17.1
```
Material requires MkDocs >= 0.17.1.
[1]: https://www.mkdocs.org
### Installing Material
#### using pip
Material can be installed with `pip`:
``` sh
pip install mkdocs-material
```
#### using choco
If you're on Windows you can use [Chocolatey][2] to install [Material][3]:
``` dos
choco install mkdocs-material
```
This will install all required dependencies like [Python][4] and [MkDocs][5].
[2]: https://chocolatey.org
[3]: https://chocolatey.org/packages/mkdocs-material
[4]: https://chocolatey.org/packages/python
[5]: https://chocolatey.org/packages/mkdocs
#### cloning from GitHub
Material can also be used without a system-wide installation by cloning the
repository into a subfolder of your project's root directory:
``` sh
git clone https://github.com/squidfunk/mkdocs-material.git
```
This is especially useful if you want to [extend the theme][6] and
[override some parts][7] of the theme. The theme will reside in the folder
`mkdocs-material/material`.
[6]: customization.md#extending-the-theme
[7]: customization.md#overriding-partials
### Troubleshooting
!!! warning "Installation on macOS"
When you're running the pre-installed version of Python on macOS, `pip`
tries to install packages in a folder for which your user might not have
the adequate permissions. There are two possible solutions for this:
1. **Installing in user space** (recommended): Provide the `--user` flag
to the install command and `pip` will install the package in a user-site
location. This is the recommended way.
2. **Switching to a homebrewed Python**: Upgrade your Python installation
to a self-contained solution by installing Python with Homebrew. This
should eliminate a lot of problems you may be having with `pip`.
!!! failure "Error: unrecognized theme 'material'"
If you run into this error, the most common reason is that you installed
MkDocs through some package manager (e.g. Homebrew or `apt-get`) and the
Material theme through `pip`, so both packages end up in different
locations. MkDocs only checks its install location for themes.
### Alternative: Using Docker
If you're familiar with Docker, the official [Docker image][8] for Material
comes with all dependencies pre-installed and ready-to-use with the latest
version published on PyPI, packaged in a very small image. Pull it with:
```
docker pull squidfunk/mkdocs-material
```
The `mkdocs` executable is provided as an entrypoint, `serve` is the default
command. Start the development server in your project root with:
```
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
```
If you're using Windows command prompt (`cmd.exe`), substitute `${PWD}` with
`"%cd%"`.
[8]: https://hub.docker.com/r/squidfunk/mkdocs-material/
## Usage
In order to enable the theme just add one of the following lines to your
project's `mkdocs.yml`. If you installed Material using a package manager:
``` yaml
theme:
name: 'material'
```
If you cloned Material from GitHub:
``` yaml
theme:
name: null
custom_dir: 'mkdocs-material/material'
```
MkDocs includes a development server, so you can review your changes as you go.
The development server can be started with the following command:
``` sh
mkdocs serve
```
Now you can point your browser to [http://localhost:8000][9] and the Material
theme should be visible. From here on, you can start writing your documentation,
or read on and customize the theme.
[9]: http://localhost:8000
## Configuration
### Color palette
A default hue is defined for every primary and accent color on Google's
Material Design [color palette][10], which makes it very easy to change the
overall look of the theme. Just set the primary and accent colors using the
following variables:
``` yaml
theme:
palette:
primary: 'indigo'
accent: 'indigo'
```
Color names are case-insensitive, but must match the names of the Material
Design color palette. Valid values are: `red`, `pink`, `purple`, `deep purple`,
`indigo`, `blue`, `light blue`, `cyan`, `teal`, `green`, `light green`, `lime`,
`yellow`, `amber`, `orange`, `deep orange`, `brown`, `grey`, `blue grey` and
`white`. The last four colors can only be used as a primary color.
If the color is set via this configuration, an additional CSS file that
defines the color palette is automatically included. If you want to keep things
lean, clone the repository and recompile the theme with your custom colors set.
See the guide on [customization][11] for more information.
[10]: http://www.materialui.co/colors
[11]: customization.md
#### Primary colors
> Default: `indigo`
Click on a tile to change the primary color of the theme:
#### Accent colors
> Default: `indigo`
Click on a tile to change the accent color of the theme:
### Font family
> Default: `Roboto` and `Roboto Mono`
By default the [Roboto font family][12] is included with the theme, specifically
the regular sans-serif type for text and the `monospaced` type for code. Both
fonts are loaded from [Google Fonts][13] and can be changed to other fonts,
like for example the [Ubuntu font family][14]:
``` yaml
theme:
font:
text: 'Ubuntu'
code: 'Ubuntu Mono'
```
The text font will be loaded in weights 400 and **700**, the `monospaced` font
in regular weight. If you want to load fonts from other destinations or don't
want to use the Google Fonts loading magic, just set `font` to `false`:
``` yaml
theme:
font: false
```
[12]: https://fonts.google.com/specimen/Roboto
[13]: https://fonts.google.com
[14]: https://fonts.google.com/specimen/Ubuntu
### Logo
> Default icon: `school`
Your logo should have rectangular shape with a minimum resolution of 128x128,
leave some room towards the edges and be composed of high contrast areas on a
transparent ground, as it will be placed on the colored header bar and drawer.
Simply create the folder `docs/images`, add your logo and embed it with:
``` yaml
theme:
logo: 'images/logo.svg'
```
Additionally, the default icon can be changed by setting an arbitrary ligature
(or Unicode code point) from the [Material Design icon font][15], e.g.
``` yaml
theme:
logo:
icon: 'cloud'
```
[15]: https://material.io/icons/
### Language
!!! info "Call for Contributions: Add languages/translations to Material"
Help translate Material into more languages - it's just **one click** and
takes approximately **2 minutes**: [click here](http://bit.ly/2EbzFc8)
#### Localization
> Default: `en`
Material for MkDocs supports internationalization (i18n) and provides
translations for all template variables and labels in the following languages:
Specify the language with:
``` yaml
theme:
language: 'en'
```
If the language is not specified, Material falls back to English. To create a
translation for another language, copy the localization file of an existing
language, name the new file using the [2-letter language code][16] and adjust
all translations:
``` sh
cp partials/language/en.html partials/language/jp.html
```
[16]: https://www.w3schools.com/tags/ref_language_codes.asp
#### Text direction
> Default: best match for given theme language, automatically set
Material supports both, left-to-right (`ltr`) and right-to-left (`rtl`) text
direction. This enables more languages like Arabic, Hebrew, Syriac and others
to be used with the theme:
``` yaml
theme:
direction: 'rtl'
```
#### Site search
> Default: best match for given theme language, automatically set
Site search is implemented using [lunr.js][17], which includes stemmers for the
English language by default, while stemmers for other languages are included
with [lunr-languages][18], both of which are integrated with this theme.
Material selects the matching (or best-matching) stemmer for the given theme
language. Multilingual search can be activated in your project's `mkdocs.yml`
by explicitly defining the search language(s):
``` yaml
extra:
search:
language: 'en, de, ru'
```
At the time of writing, the following languages are supported: