2023-08-17 23:54:17 +01:00
---
title: Customizing Hextra
linkTitle: Customization
---
2023-08-21 01:00:52 +01:00
2023-08-21 23:41:37 +01:00
Hextra offers some default customization options in the `hugo.yaml` config file to configure the theme.
This page describes the available options and how to customize the theme further.
<!-- more -->
2023-08-21 01:00:52 +01:00
## Custom CSS
2023-09-13 14:34:46 -07:00
To add custom CSS, we need to create a file `assets/css/custom.css` in our site. Hextra will automatically load this file.
### Font Family
The font family of the content can be customized using:
2023-08-21 23:41:37 +01:00
```css {filename="assets/css/custom.css"}
.content {
font-family: "Times New Roman", Times, serif;
}
```
2023-09-13 14:34:46 -07:00
### Inline Code Element
The color of text mixed with `other text` can customized with:
```css {filename="assets/css/custom.css"}
.content code:not(.code-block code) {
color: #c97c2e ;
}
```
2023-08-21 23:41:37 +01:00
### Primary Color
2023-10-04 20:41:59 +01:00
The primary color of the theme can be customized by setting the `--primary-hue` and `--primary-saturation` variables:
2023-08-21 23:41:37 +01:00
```css {filename="assets/css/custom.css"}
:root {
--primary-hue: 100deg;
2023-10-04 20:41:59 +01:00
--primary-saturation: 90%;
2023-08-21 23:41:37 +01:00
}
```
### Syntax Highlighting
List of available syntax highlighting themes are available at [Chroma Styles Gallery ](https://xyproto.github.io/splash/docs/all.html ). The stylesheet can be generated using the command:
2023-11-11 20:14:39 -05:00
```shell
hugo gen chromastyles --style=github
2023-08-21 23:41:37 +01:00
```
To override the default syntax highlighting theme, we can add the generated styles to the custom CSS file.
## Custom Scripts
You may add custom scripts to the end of the head for every page by adding the following file:
```
layouts/partials/custom/head-end.html
```
## Custom Layouts
The layouts of the theme can be overridden by creating a file with the same name in the `layouts` directory of your site.
For example, to override the `single.html` layout for docs, create a file `layouts/docs/single.html` in your site.
For further information, refer to the [Hugo Templates ](https://gohugo.io/templates/ ).
## Further Customization
2023-11-11 20:14:39 -05:00
Didn't find what you were looking for? Feel free to [open a discussion ](https://github.com/imfing/hextra/discussions ) or make a contribution to the theme!