Theme Colors and Fonts

We uses variables for typical global theme settings, such as colors and fonts. It’s easy to change the theme to your brand color and typography.

You can edit these variables in the config.yml

Colors

You can edit the main theme colors in the config.yml

# config.yml

colors:
  # light
  base_bg: "#ffffff"
  base_bg_2: "#f8fafc"
  base_bg_3: "#f1f5f9"
  base_text: "#202020"
  base_text_2: "#4b5563"
  primary_bg: "#2b3af7"
  primary_bg_2: "#424ff8"
  primary_bg_3: "#702bf7"
  primary_text: "#fdfcf9"
  header_text: "#2b3af7"
  logo_text: "#2b3af7"

  # dark
  base_bg_dark: "#121212"
  base_bg_2_dark: "#1e1e1e"
  base_bg_3_dark: "#232323"
  base_text_dark: "#ffffff"
  base_text_2_dark: "#d7d7d7"
  primary_bg_dark: "#2b3af7"
  primary_bg_2_dark: "#424ff8"
  primary_bg_3_dark: "#702bf7"
  primary_text_dark: "#fdfcf9"
  logo_text_dark: "#ffffff"
  header_text_dark: "#ffffff"

Fonts

This theme supports both self hosted fonts and Google fonts. By default it is configured to use self hosted fonts. This theme uses Google Fonts. If you want to use different fonts, visit the Google fonts website, select your fonts, then copy and paste the <link> code snippet into the google_fonts field in the config.yml. Below this field update the heading, base and monospace fields with the name of the new font.

# config.yml

fonts:
  use_google_fonts: false
  google_fonts_url: "https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&family=Source+Code+Pro&family=Source+Sans+3:wght@300;400;700&display=swap"
  use_self_hosted_fonts: true # font files must be placed in /static/fonts folder and the @font-face definitions must be added to /static/fonts/fonts.css
  logo: "Lato"
  heading: "Lato"
  base: "'Source Sans 3'"
  monospace: "'Source Code Pro'"

External Google Fonts

Google fonts are more convienent and easier to update.

Set use_google_fonts: true and use_self_hosted_fonts: false. Then update google_fonts with the URL that is generted by the google fonts website

In the screenshot below you can see we have selected 3 fonts with the various fonts weights we need. This generates the embed code on the right. We need to just copy the URL starting from https: - which in this example is "https://fonts.googleapis.com/css2?family=Fira+Mono&family=Montserrat:wght@400;500&family=Open+Sans:wght@300;400;500;600;700&display=swap"

Google fonts embed link example

We could then use any of these fonts, “Montserrat”, “Open Sans” and “Fira Mono”.

In the updated config.yml below we’ve updated the Heading and Logo fonts to use “Montserrat” a slightly more traditional serif font.

# config.yml

  use_google_fonts: true # if true will use external google_fonts url below
  google_fonts_url: "https://fonts.googleapis.com/css2?family=Fira+Mono&family=Montserrat:wght@400;500&family=Open+Sans:wght@300;400;500;600;700&display=swap"
  use_self_hosted_fonts: false # font files must be placed in /static/fonts folder and the @font-face definitions must be added to /static/fonts/fonts.css
  logo: "Montserrat"
  heading: "Montserrat"
  base: "Open Sans"
  monospace: "Fira Mono"

Self Hosted Fonts

Self hosted fonts are privacy friendly and arguably may be faster to serve.

Updating your own fonts can be difficult, as it involves finding and installing web ready font files. It also involves generating @font-face definitions and adding them to the CSS files. We do not actively support troubleshooting self hosted fonts, sorry.

To update the fonts,

We used https://gwfh.mranftl.com/fonts to download Google Fonts and also generate the @font-face defintiions. But this is just one way of doing it, and you may still need to tweak the code it generates!

Add the new font files to static/fonts/- you will be able to see the existing installed fonts here and hopefully use them as a reference.

For example you might add static/fonts/montserrat/montserrat-v26-latin-regular.woff2

Edit static/fonts/fonts.css and add the new @font-face defintions. They will look something like this

/* static/fonts/fonts.css */

@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  src: url('./montserrat/montserrat-v26-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

Its important to get the src property correct, it should be a relative path to where you installed the actual font files. In the case of the example above we installed them at static/fonts/montserrat/montserrat-v26-latin-regular.woff2

Now these fonts will be available in the config.yml

# config.yml

  use_google_fonts: false
  google_fonts_url: ""
  use_self_hosted_fonts: true 
  heading: "Montserrat"
  base: "Open Sans"
  monospace: "Fira Mono"
  logo: "Montserrat"