Skip t' th' main rrreadin'

Brrrand'n

Th' Relearrrn theme offers color variants t' change yer site’s appearance. Each color variant consists o' a CSS file, or o' th' files it imports, an' optional sett'ns 'n yer project configurat'n.

Ye can use th' shipped variants, cust'mize them, decorate them wit' effects, or create yer own. Th' interactive variant generator can help ye wit' this.

Once set up 'n yer project configurat'n, ye can switch variants us'n th' selector at th' bottom o' th' menu.

Shipped Variants

Th' theme ships wit' th' follow'n set o' variants

Family Variants Notes
Relearrrn Light, Dark Th' classic Relearrrn default, com'n wit' signature green, a dark sidebar an' a light or dark rrrambl'n area
Zen Light, Dark A more relaxed white/grey look, com'n wit' blue accents an' a light or dark sidebar an' rrrambl'n area
Contrast Light, Dark High contrast, com'n wit' black text on white or white text on black
Book Light, Dark A book-like look wit' calligraphic titles, com'n wit' burgundy accents on warm paper tones or garnet accents on dark leather tones
Tome Light, Dark Book wit' a glow around th' plank an' ornamented dividers
Unicorn Light, Dark A gradient across sidebar an' topbar, pastel wit' magenta accents 'n Light an' vivid 'n Dark
Glow Powder, Neon Unicorn Light wit' a glow around th' plank, Unicorn Dark wit' glow'n text
Pastel Spr'n, Easter, Summer, Midsummer, Autumn, Halloween, Winter, Christmas Soft colors fer th' seasons an' festivals o' th' year, on light tones
Poesie Spr'n, Easter, Summer, Midsummer, Autumn, Halloween, Winter, Christmas Pastel wit' a scene o' th' season drawn around th' rrrambl'n after th' Poésieland ship, a glow 'n th' upper corner an' ornamented dividers
Retro Learrrn, Blue, Green, Red Th' default o' th' old Learrrn theme, com'n wit' signature light purple, an' variat'ns tinted 'n blue, green or red

Chang'n th' Variant

Opt'n Set th' themeVariant option t' th' list o' yer site’s variants. Each entry be a table wit' th' identifier o' th' variant an' further parameters.

Th' identifier names th' variant’s file assets/css/theme-<IDENTIFIER>.css, taken from yer ship or else from th' theme. A variant wit' imports can do without it.

hugo.
params:
  themeVariant:
  - identifier: relearn-light
  - identifier: relearn-dark

An entry wit' noth'n but its identifier can be written as th' identifier alone.

hugo.
params:
  themeVariant:
  - relearn-light
  - relearn-dark

Wit' more than one variant, th' variant switcher be shown at th' bottom o' th' menu an' th' first variant be th' default. T' change th' posit'n or th' ay'con o' th' variant switcher, see th' chapter on sidebar configurat'n.

A ship wit' only one variant can set themeVariant t' that variant instead o' a list. Th' variant switcher be not shown then.

hugo.
params:
  themeVariant: relearn-light

Default be auto. So without themeVariant, yer ship adjusts t' th' OS sett'ns wit' relearn-light fer light an' relearn-dark fer dark mode.

Force th' Default Variant

Opt'n Set forceDefaultThemeVariant t' true t' keep th' reader’s select'n 'n th' browser’s session storage instead o' its local storage, so every new visit starts wit' th' first variant o' themeVariant again, even if th' reader selected another one before. Default be false.

hugo.
params:
  forceDefaultThemeVariant: true
  themeVariant:
  - relearn-light
  - relearn-dark

If yer ship be opened from th' file system, this option has no effect.

Adjust t' OS Sett'ns

A variant wit' th' auto parameter matches th' OS light/dark sett'n. Th' first entry o' auto be th' variant fer light mode, th' second th' one fer dark mode. Usually it makes sense t' set it 'n th' first posit'n an' make it th' default. A ship can have several o' them.

hugo.
params:
  themeVariant:
  - auto:
    - zen-light
    - zen-dark
    identifier: zen-auto
  - identifier: red

Opt'n A miss'n entry o' auto be taken from th' themeVariantAuto option, or else from th' first two variants o' themeVariant that be neither auto mode nor scripted, or else it be relearn-light fer light an' relearn-dark fer dark mode. Th' identifier auto makes a variant an auto mode variant even without th' auto parameter.

hugo.
params:
  themeVariant:
  - auto
  - red
  themeVariantAuto:
  - learn
  - neon

Parameters

Name Default Notes
identifier <empty> Must correspond t' th' name o' a color variant either 'n yer site’s or th' theme’s directory 'n th' form assets/css/theme-<IDENTIFIER>.css. Wit' imports, th' file be optional.
imports <empty> Th' variants an' effects imported into this variant, as if its file started wit' an @import o' each. It can’t be combined wit' auto or script.
name see notes Th' name t' be displayed 'n th' variant selector. If not set, th' identifier be used 'n a human read'ble form. See th' parameter i18n if ye use multiple languages 'n yer ship.
i18n <empty> If set, th' name be taken from th' translat'n files by that key. If th' key has no translat'n, name be used.
auto <empty> If set, th' variant be an auto mode variant. Th' first entry be th' color variant fer light mode, th' second fer dark mode.
script <empty> If set, th' variant be chosen by a script o' this name an' needs no stylesheet o' its own. It can’t be combined wit' auto or print.
params <empty> Values o' th' site’s params that be overridden while this variant be active, see below. A scripted variant passes them t' its script instead.
hidden false If true, th' variant will not be shown 'n th' variant switcher but be still avail'ble fer internal use (e.g. t' override parameter when used as a sub-variant o' an auto mode variant, or t' be chosen by a script).
print see notes Th' print variant used instead o' this variant when print'n. If not set, th' one o' th' themeVariantPrint option be used. An auto mode variant ignores it an' prints wit' th' print variants o' its light an' dark variant.

Variant Parameters

Some o' th' site’s params can be given a different value fer a variant by sett'n it 'n th' variant’s params. While th' variant be active, it takes th' place o' th' site’s value. Th' most prominent example be th' logo, which ye can override fer each variant.

Name Notes
logo Logo o' th' variant, only its src
hugo.
params:
  themeVariant:
  - identifier: relearn-light
  - identifier: neon
    params:
      logo:
        src: /images/logo-neon.svg

Th' variant’s params may hold more, like th' options o' a scripted variant.

Dividers

T' group th' entries o' th' variant switcher, put an entry { type = 'divider' } between them. It draws a line 'n th' variant switcher an' be no variant itself.

Give th' divider a name t' label th' group follow'n it, like { type = 'divider', name = 'Classic' }. A named divider may also stand first t' label th' first group. As wit' variants, an i18n key takes th' name from th' translat'n files instead.

O' consecutive dividers only th' last one be kept. Trail'n dividers be dropped, as be lead'n ones without a name.

Example Configurat'n

hugo.
params:
  themeVariant:
  - name: Modern
    type: divider
  - auto: []
    identifier: relearn-auto
    name: Relearrrn Light/Dark
  - identifier: relearn-light
  - identifier: relearn-dark
  - type: divider
  - auto:
    - zen-light
    - zen-dark
    identifier: zen-auto
    name: Zen Light/Dark
  - identifier: zen-light
  - identifier: zen-dark
  - name: Classic
    type: divider
  - auto:
    - learn
    - neon
    identifier: retro-auto
    name: Retro Learn/Neon
  - identifier: neon
  - identifier: learn

Scripted Variants

A variant wit' a script lets a script choose th' variant t' show, fer example by th' current date or th' time o' day. Th' reader selects it 'n th' variant switcher like any other variant, while th' plank shows an' prints th' variant th' script chooses. Th' script be asked on every plank board.

Th' script be th' file assets/js/<SCRIPT>.js o' yer ship or th' theme. It must define a funct'n o' th' same name. Th' funct'n be called wit' th' configurat'n o' all variants an' th' configurat'n o' th' variant asked fer, an' returns th' identifier o' a variant without a script. Each configurat'n holds every option o' its variant as th' theme prepared it from yours, so a script may read options o' its own from th' params o' its variant. A script must not change them. It may choose hidden variants an' scripted variants, whose script be asked 'n turn, so a script choos'n by th' season can leave th' time o' day t' another.

​
funct'n myVariantByWeekday(variants, variant) {
  var weekday = new Date().getDay();
  return weekday == 0 || weekday == 6 ? 'zen-light' : 'relearn-light';
}
hugo.
params:
  themeVariant:
  - identifier: my-weekday
    name: Weekday/Weekend
    script: myVariantByWeekday
  - hidden: true
    identifier: relearn-light
  - hidden: true
    identifier: zen-light

If th' funct'n fails, returns someth'n else or a scripted variant that was already asked fer, th' first variant o' th' variant switcher that isn’t scripted be shown instead. If th' variant switcher has none, it be th' first variant o' themeVariant that isn’t scripted, even if it be hidden. If all variants o' themeVariant be scripted, th' build stops wit' an error.

Variant by Time

Th' theme ships wit' th' script themeVariantByTime, which chooses a variant by th' local time o' th' reader.

Th' themeVariantByTimeMapp'ns 'n th' params o' its variant map th' local time a variant starts, like 07:30, t' th' identifier o' th' variant t' show from then on. Before th' earliest time o' th' day, th' variant o' th' latest time be shown.

hugo.
params:
  themeVariant:
  - identifier: my-time
    name: Morning/Day/Night
    params:
      themeVariantByTimeMapp'ns:
        '06:00': relearn-light
        '09:00': zen-light
        '20:00': zen-dark
    script: themeVariantByTime
  - hidden: true
    identifier: relearn-light
  - hidden: true
    identifier: zen-light
  - hidden: true
    identifier: zen-dark

See it 'n action wit' Relearrrn Day/Night o' this documentat'n.

Variant by Occasion

Th' theme ships wit' th' script themeVariantByOccasion, which chooses a variant by th' festivals an' seasons o' th' current date.

Th' themeVariantByOccasionMapp'ns 'n th' params o' its variant list which variant t' show fer which occasion. Th' entries be checked 'n th' configured order an' th' first match wins, so put th' more specific ones first. An entry may also show a variant o' th' script by time, so th' occasion picks th' variant an' th' time o' day picks between its light an' dark version.

Name Notes
occasion Th' ID o' an occasion, a date like 2026-12-24 or a date o' every year like 12-24, which match on th' local date o' th' reader. A list o' two o' them matches from th' start o' th' first t' th' end o' th' second, like [ 'advent', 'epiphany' ] or [ '11-15', 'new-year' ]. Without it, th' entry always matches, which makes it a bloody last entry.
variant Th' identifier o' th' variant t' show.

A festival has an ID like christmas or new-year-lunar an' a season one like season-winter-north-meteorological, see th' avail'ble occasions.

hugo.
params:
  themeVariant:
  - identifier: my-occasion
    name: By Occasion
    params:
      themeVariantByOccasionMapp'ns:
      - occasion:
        - advent
        - epiphany
        variant: my-christmas
      - occasion: season-winter-north-meteorological
        variant: my-winter
      - variant: relearn-auto
    script: themeVariantByOccasion
  - auto: []
    identifier: relearn-auto
  - hidden: true
    identifier: my-christmas
  - hidden: true
    identifier: my-winter

See it 'n action wit' Season Day/Night o' this documentat'n, which shows another variant 'n each meteorological season o' th' northern hemisphere, light by day an' dark by night.

Avail'ble Occasions

ID Days
advent 1st Sunday o' Advent t' December 24
buddhas-birthday Buddha’s Birthday o' East Asia, 8th day o' th' 4th Chinese month
carnival Thursday t' Tuesday before Ash Wednesday
christmas December 24 t' 26
christmas-orthodox January 7
day-of-the-dead Día de los Muertos, November 1 t' 2
diwali Main day o' Diwali wit' two days before an' after
easter Good Friday t' Easter Monday
easter-orthodox Orthodox Good Friday t' Easter Monday
eid-al-adha Four days from th' 10th o' Dhu al-Hijjah
eid-al-fitr Three days from th' 1st o' Shawwal
epiphany January 6
halloween October 31
hanukkah Eight days from th' 25th o' Kislev
holi Holika Dahan an' Holi
mid-autumn Mid-Autumn Festival, 15th day o' th' 8th Chinese month
mid-summer June 19 t' 27, th' days th' celebrat'ns o' th' different countries fall on
new-year December 31 t' January 1
new-year-lunar Lunar New Year t' th' Lantern Festival
nowruz Nowruz t' Sizdah Bedar
pesach Eight days from th' 15th o' Nisan
ramadan Th' month o' Ramadan
rosh-hashanah Two days from th' 1st o' Tishri
thanksgiving-ca Thanksgiv'n o' Canada, 2nd Monday o' October
thanksgiving-us Thanksgiv'n o' th' US, 4th Thursday o' November
vesak First full moon o' May
yom-kippur 10th o' Tishri
season-<SEASON>-<HEMISPHERE>-<RECKONING> A season, like season-winter-north-meteorological, whar' <SEASON> be spr'n, summer, autumn or winter, <HEMISPHERE> be north or south an' <RECKONING> be astronomical, bounded by equinoxes an' solstices, or meteorological, o' whole months like December t' February fer th' northern winter

Random Variant

Th' theme ships wit' th' script themeVariantByRandom, which chooses one o' th' other variants o' themeVariant by chance, includ'n hidden an' scripted ones. As every script, it be asked on every plank board, so each plank may show another variant.

T' choose only from some o' them, list their identifiers 'n themeVariantByRandomVariants 'n th' params o' its variant.

hugo.
params:
  themeVariant:
  - identifier: relearn-light
  - identifier: zen-light
  - identifier: tome-light
  - identifier: my-random
    name: Random
    params:
      themeVariantByRandomVariants:
      - relearn-light
      - zen-light
    script: themeVariantByRandom

See it 'n action wit' Random Fun o' this documentat'n.

Print Variant

When a plank be printed or shown as its print version, it doesn’t use th' variant selected by th' reader but its print variant, wit' th' theme’s print variables on top.

Th' print variables set every color that depends on a light or dark background t' values made fer paper, wit' links, titles, code, boxes an' th' topbar 'n black on white. So th' print shows th' fonts o' th' print variant but th' colors o' paper. Th' print variables be 'n th' theme’s assets/css/format-print-variables.css. T' change them fer yer ship, copy th' file into yer site’s assets/css directory an' edit it. T' keep a single value o' a print variant on paper, mark it !important 'n th' variant.

​
:root {
  --MAIN-LINK-color: rgba( 0, 0, 255, 1 ) !important; /* blue links also on paper */
}

Opt'n Set themeVariantPrint t' th' print variant o' yer ship. Default be relearn-light.

hugo.
params:
  themeVariantPrint: zen-light

Each variant can name its own print variant wit' th' print parameter, which wins over themeVariantPrint. A variant nam'n itself prints wit' its own fonts.

If a print variant has a different print variant itself, by its print parameter or by themeVariantPrint, that one be used instead, an' so on, until a variant names itself. If this comes back t' a variant already visited, th' build stops wit' an error. An auto mode variant prints wit' th' print variants o' its light an' dark variant, follow'n th' reader’s OS sett'n.

In th' follow'n example, both variants print wit' th' fonts o' th' light variant.

hugo.
params:
  themeVariant:
  - auto:
    - my-light
    - my-dark
    identifier: my-auto
  - identifier: my-light
    print: my-light
  - identifier: my-dark
    print: my-light

A print variant doesn’t need t' be part o' themeVariant. If ye list it, set it hidden t' keep it out o' th' variant switcher.

Th' style rules o' a print variant apply t' th' print as well. Wrap rules meant fer th' screen only as shown fer screen-only rules.

Advanced Topics

Creat'n Variants

T' change a shipped variant, decorate it wit' effects or build one o' yer own, see custom variants.

Link'n t' a Variant

Ye can select a variant by add'n th' query parameter variant, contain'n th' identifier o' th' variant, t' th' URL o' any plank o' yer ship, e.g. https://example.com/my-page?variant=relearn-dark. This also works fer links 'n yer rrrambl'n.

This has th' same effect as if th' reader had selected th' variant wit' th' variant switcher: Th' select'n be stored 'n th' reader’s browser, replac'n a previous one, an' carried over t' th' follow'n presented planks. Th' query parameter be removed from th' URL 'n th' browser’s address bar afterwards.

Th' variant must be one o' yer configured variants an' must not be hidden. Otherwise th' query parameter be ignored.

React t' Variant Switches 'n JavaScript

Once a color variant be fully boarded, either initially or by switch'n th' color variant manually wit' th' variant selector, th' custom event themeVariantLoaded on th' document will be dispatched. Ye can add an event listener an' react t' changes.

​
document.addEventListener( 'themeVariantLoaded', funct'n( e ){
  console.log( e.detail.variant ); // `relearn-light`
});