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 _data/site.yml

Colors

You can edit the main theme colors in the _data/site.yml

# _data/site.yml

colors:
  #light-mode colors
  primary_bg: "#2b3af7"
  primary_bg_2: "#424ff8"
  primary_bg_3: "#702bf7"
  primary_text: "#fdfcf9"
  base_bg: "#ffffff"
  base_bg_2: "#f8f9ff"
  base_bg_3: "#eef2f9"
  text: "#0d042b"
  text_2: "#3b364c"
  logo_text: "#2b3af7"
  header_text: "#0d042b"

  # dark-mode colors
  primary_bg_dark: "#2b3af7"
  primary_bg_2_dark: "#424ff8"
  primary_bg_3_dark: "#702bf7"
  primary_text_dark: "#fdfcf9"
  base_bg_dark: "#0f0f10"
  base_bg_2_dark: "#1a191c"
  base_bg_3_dark: "#222124"
  text_dark: "#f5f5ec"
  text_2_dark: "#b6c3d6"
  logo_text_dark: "#2b3af7"
  header_text_dark: "#f5f5ec"

Fonts

This theme supports both self hosted fonts and Google fonts. By default it is configured to use self hosted fonts for improved privacy and GDPR compliance.

# _data/site.yml

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

External Google Fonts

Google fonts are more convienent and easier to use.

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.yaml below we’ve updated the Heading and Logo fonts to use “Montserrat” a slightly more traditional serif font.

# _data/site.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 /assets/fonts folder and the @font-face definitions must be added to /assets/css/fonts.css
  heading: "Montserrat"
  base: "Open Sans"
  monospace: "Fira Mono"
  logo: "Montserrat"

Self Hosted Fonts

Self hosted fonts are privacy friendly and arguably faster to load.

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.

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 assets/fonts/- you will be able to see the existing installed fonts here and hopefully use them as a reference.

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

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

/* assets/css/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('../fonts/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 assets/fonts/montserrat/montserrat-v26-latin-regular.woff2

Now these fonts will be available in the _data/site.yml

# _data/site.yml

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