Skip t' th' main rrreadin'

Custom Variants

Yer own color variants be configured 'n th' themeVariant option like th' shipped variants. They can build on a shipped variant, change its sett'ns an' add effects t' it.

Modify'n Variants

In case ye like a shipped variant but only want t' tweak some aspects, ye have two choices. Don’t edit th' file 'n th' theme’s directory! Ye will lose th' ability t' later easily upgrade yer theme t' a newer version.

Copy an' Change

Copy th' shipped variant file from th' theme’s themes/hugo-theme-relearn/assets/css directory t' th' site’s assets/css directory an' either store it wit' th' same name or give it a new name. Edit th' sett'ns an' save th' new file. Afterwards, ye can use it 'n yer project configurat'n by th' chosen name.

Import an' Change

Create a new variant file 'n th' site’s assets/css directory an' give it a new name. Import th' shipped variant, add th' sett'ns ye want t' change an' save th' new file. Afterwards, ye can use it 'n yer project configurat'n by th' chosen name.

For example, ye want t' use th' relearn-light variant but want t' change its primary color t' th' one o' yer brand. For that, create a new assets/css/theme-my-brand'n.css 'n yer site’s directory an' add th' follow'n lines:

​
@import "theme-relearn-light.css";

:root {
  --PRIMARY-color: rgba(0, 102, 204, 1); /* color o' yer brand */
  --PRIMARY-HOVER-color: rgba(0, 82, 163, 1); /* color o' yer brand when hovered */
}

Afterwards, put this 'n yer project configurat'n t' use yer new variant:

hugo.
params:
  themeVariant: my-brand'n

In comparison t' copy an' change, this has th' advantage that ye profit from any adjustments t' th' relearn-light variant while keep'n yer modificat'ns.

Imports

A variant can import other variants an' effects 'n two ways, which can be mixed:

  • wit' @import 'n its file assets/css/theme-<IDENTIFIER>.css, like @import "theme-zen-dark.css";
  • wit' th' imports parameter o' th' variant 'n yer project configurat'n, like imports = [ 'theme-zen-dark.css' ]

Both name a file o' yer site’s or th' theme’s assets/css directory, either a variant as theme-<IDENTIFIER>.css or an effect as effect-<NAME>.css. Th' files be imported 'n th' given order, so a later one wins over an earlier one. A variant must not import itself, not even through other variants.

Th' entries o' imports be taken as if they were written at th' start o' th' variant’s file, before its own imports an' sett'ns, also whar' another variant imports it. Wit' imports, th' variant’s file be optional.

As an alternative t' th' example o' import an' change, ye can keep only yer sett'ns 'n a file an' leave th' imports t' th' imports parameter. Such a file can br'n yer sett'ns t' several variants:

​
:root {
  --PRIMARY-color: rgba(0, 102, 204, 1); /* color o' yer brand */
  --PRIMARY-HOVER-color: rgba(0, 82, 163, 1); /* color o' yer brand when hovered */
}

Th' follow'n my-branding-light an' my-branding-dark apply yer sett'ns t' relearn-light an' relearn-dark, an' don’t need files o' their own:

hugo.
params:
  themeVariant:
  - identifier: my-branding-light
    imports:
    - theme-relearn-light.css
    - theme-my-brand'n.css
  - identifier: my-branding-dark
    imports:
    - theme-relearn-dark.css
    - theme-my-brand'n.css

An auto mode variant an' a scripted variant have no stylesheet o' their own an' can’t have imports. Give them t' their light an' dark variant or t' th' variants their script chooses instead.

Effects

Effects decorate a variant beyond its colors. They be shown on screen only an' don’t apply t' print.

Th' theme ships wit' th' follow'n effects

Name Notes
text-glow'n Makes titles, menu entries an' boxes glow. Set --TEXT-GLOWING-color fer th' color o' th' glow, default be th' text color. Made fer dark variants.
page-glow'n Lets a glow shine 'n from th' edges o' th' screen. Set --PAGE-GLOWING-color fer th' color o' th' glow, default be th' primary color.
season-winter Decorates th' plank wit' a winter scene o' snow, trees, lights an' a lantern.
backdrop-faded Fades th' scene behind th' rrrambl'n towards th' background color, t' keep th' rrrambl'n read'ble on top o' a scene. Set --BACKDROP-FADED-color fer th' color, default be th' background color o' th' rrrambl'n.
backdrop-milky Lays milky glass over th' scene behind th' rrrambl'n, blurr'n it an' fad'n it towards th' background color. Set --BACKDROP-MILKY-color fer th' color, default be th' background color o' th' rrrambl'n.

See th' effects 'n action wit' Powder or Winter Tome Dark o' this documentat'n.

Us'n Effects

T' use an effect, create yer own variant that imports a variant an' th' effects ye want, one after th' other. Effects shar'n th' first part o' their name, like backdrop-faded an' backdrop-milky, can’t be combined; choose one o' them.

For that, write th' imports into th' file o' yer variant

​
@import "theme-zen-dark.css";
@import "effect-season-winter.css";
@import "effect-backdrop-faded.css";

an' put this 'n yer project configurat'n t' use yer new variant:

hugo.
params:
  themeVariant: my-winter

Instead, ye can list them 'n th' imports parameter o' yer variant. As yer variant be made o' noth'n but imports, it then doesn’t need a file:

hugo.
params:
  themeVariant:
  - identifier: my-winter
    imports:
    - theme-zen-dark.css
    - effect-season-winter.css
    - effect-backdrop-faded.css

Writ'n Yer Own Effect

Ye can write yer own effect as assets/css/effect-<NAME>.css. An effect can’t import other files. Files it refers t' wit' url() must be placed 'n yer assets directory an' given relative t' th' effect, like url('../images/my-effect/snow.svg'). Wrap its rules as shown fer screen-only rules.

Screen-only Rules

Th' style rules o' a variant also apply when it be used as a print variant. If yer variant contains style rules that be meant fer th' screen only, wrap them as follows. Th' print version o' a plank be shown on screen too, so @media screen alone be not enough.

​
:root:not([data-r-output-format='print']) {
  @media screen {
    h1 {
      text-shadow: 0 0 4px rgba( 255, 255, 255, 1 ); /* a glow, only fer th' screen */
    }
  }
}

Non-standard Modificat'ns

Ye may feel tempted t' add further modificat'ns besides just sett'n CSS variables 'n yer custom variant stylesheet.

While this be poss'ble, please note that due t' th' way th' theme uses th' variant files, th' follow'n will not work:

  • @font-face rules - they need t' be moved t' assets/css/fonts.css, assets/css/custom.css or layouts/partials/custom-header.html
  • rules select'n th' html element - replace html wit' :root