Advanced Customisation
Table of Contents
There are many ways you can make advanced changes to Blowfish. Read below to learn more about what can be customised and the best way of achieving your desired result.
If you need further advice, post your questions on GitHub Discussions.
Hugo project structure #
Before leaping into it, first a quick note about Hugo project structure and best practices for managing your content and theme customisations.
Blowfish is built to take advantage of all the standard Hugo practices. It is designed to allow all aspects of the theme to be customised and overriden without changing any of the core theme files. This allows for a seamless upgrade experience while giving you total control over the look and feel of your website.
In order to achieve this, you should never manually adjust any of the theme files directly. Whether you install using Hugo modules, as a git submodule or manually include the theme in your themes/
directory, you should always leave these files intact.
The correct way to adjust any theme behaviour is by overriding files using Hugo’s powerful file lookup order. In summary, the lookup order ensures any files you include in your project directory will automatically take precedence over any theme files.
For example, if you wanted to override the main article template in Blowfish, you can simply create your own layouts/_default/single.html
file and place it in the root of your project. This file will then override the single.html
from the theme without ever changing the theme itself. This works for any theme files - HTML templates, partials, shortcodes, config files, data, assets, etc.
As long as you follow this simple practice, you will always be able to update the theme (or test different theme versions) without worrying that you will lose any of your custom changes.
Colour schemes #
Blowfish ships with a number of colour schemes out of the box. To change the basic colour scheme, you can set the colorScheme
theme parameter. Refer to the Getting Started section to learn more about the built-in schemes.
In addition to the default schemes, you can also create your own and re-style the entire website to your liking. Schemes are created by by placing a <scheme-name>.css
file in the assets/css/schemes/
folder. Once the file is created, simply refer to it by name in the theme configuration.
Blowfish defines a three-colour palette that is used throughout the theme. The three colours are defined as neutral
, primary
and secondary
variants, each containing ten shades of colour.
Due to the way Tailwind CSS 3.0 calculates colour values with opacity, the colours specified in the scheme need to conform to a particular format by providing the red, green and blue colour values.
Table of Contents
There are many ways you can make advanced changes to Blowfish. Read below to learn more about what can be customised and the best way of achieving your desired result.
If you need further advice, post your questions on GitHub Discussions.
Hugo project structure #
Before leaping into it, first a quick note about Hugo project structure and best practices for managing your content and theme customisations.
Blowfish is built to take advantage of all the standard Hugo practices. It is designed to allow all aspects of the theme to be customised and overriden without changing any of the core theme files. This allows for a seamless upgrade experience while giving you total control over the look and feel of your website.
In order to achieve this, you should never manually adjust any of the theme files directly. Whether you install using Hugo modules, as a git submodule or manually include the theme in your themes/
directory, you should always leave these files intact.
The correct way to adjust any theme behaviour is by overriding files using Hugo’s powerful file lookup order. In summary, the lookup order ensures any files you include in your project directory will automatically take precedence over any theme files.
For example, if you wanted to override the main article template in Blowfish, you can simply create your own layouts/_default/single.html
file and place it in the root of your project. This file will then override the single.html
from the theme without ever changing the theme itself. This works for any theme files - HTML templates, partials, shortcodes, config files, data, assets, etc.
As long as you follow this simple practice, you will always be able to update the theme (or test different theme versions) without worrying that you will lose any of your custom changes.
Colour schemes #
Blowfish ships with a number of colour schemes out of the box. To change the basic colour scheme, you can set the colorScheme
theme parameter. Refer to the Getting Started section to learn more about the built-in schemes.
In addition to the default schemes, you can also create your own and re-style the entire website to your liking. Schemes are created by by placing a <scheme-name>.css
file in the assets/css/schemes/
folder. Once the file is created, simply refer to it by name in the theme configuration.
Blowfish defines a three-colour palette that is used throughout the theme. The three colours are defined as neutral
, primary
and secondary
variants, each containing ten shades of colour.
Due to the way Tailwind CSS 3.0 calculates colour values with opacity, the colours specified in the scheme need to conform to a particular format by providing the red, green and blue colour values.
:root {
--color-primary-500: 139, 92, 246;
}
This example defines a CSS variable for the primary-500
colour with a red value of 139
, green value of 92
and blue value of 246
.
Use one of the existing theme stylesheets as a template. You are free to define your own colours, but for some inspiration, check out the official Tailwind colour palette reference.
Overriding the stylesheet #
Sometimes you need to add a custom style to style your own HTML elements. Blowfish provides for this scenario by allowing you to override the default styles in your own CSS stylesheet. Simply create a custom.css
file in your project’s assets/css/
folder.
The custom.css
file will be minified by Hugo and loaded automatically after all the other theme styles which means anything in your custom file will take precedence over the defaults.
Adjusting the font size #
Changing the font size of your website is one example of overriding the default stylesheet. Blowfish makes this simple as it uses scaled font sizes throughout the theme which are derived from the base HTML font size. By default, Tailwind sets the default size to 12pt
, but it can be changed to whatever value you prefer.
Create a custom.css
file using the instructions above and add the following CSS declaration:
/* Increase the default font size */
@@ -76,12 +76,12 @@
},
// and more...
}
-
Now when you want to work on designing your site, you can invoke npm run dev
and the compiler will run in watch mode. When you’re ready to deploy, run npm run build
and you’ll get a clean Tailwind CSS build.
🙋♀️ If you need help, feel free to ask a question on GitHub Discussions.