<linkhref="https://McShelby.github.io/hugo-theme-relearn/basics/branding/index.html"rel="canonical"type="text/html"title="Branding :: Hugo Relearn Theme">
<linkhref="../../basics/branding/index.xml"rel="alternate"type="application/rss+xml"title="Branding :: Hugo Relearn Theme">
<p>The Relearn theme provides configuration options to change your your site’s colors, favicon and logo. This allows you to easily align your site visuals to your desired style. Most of these options are exposed thru so called color variants.</p>
<p>A color variant lets you customize various visual effects of your site like almost any color, used fonts, color schemes of print, syntax highligtning, Mermaid and the OpenAPI shortcode, etc. It contains of a CSS file and optional configuration options in your <code>config.toml</code>.</p>
<p>The Relearn theme ships with a wide set of different color variants. You can use them as-is, copy them over and use them as a starting point for your customizations or just create completely new variants unique to your site. The <ahref="../../basics/generator/index.html">interactive variant generator</a> may help you with this task.</p>
<p>Once configured in your <code>config.toml</code>, you can select them with the variant selector at the bottom of the menu.</p>
<h2id="theme-variant">Change the Variant (Simple)</h2>
<h3id="single-variant">Single Variant</h3>
<p>Set the <code>themeVariant</code> value to the name of your theme file. That’s it! Your site will be displayed in this variant only.</p>
<p>Your theme variant file must reside in your site’s <code>static/css</code> directory or in the theme’s <code>static/css</code> directory and the file name must start with <code>theme-</code> and end wit <code>.css</code>. In the above example, the path of your theme file must be <code>static/css/theme-relearn-light.css</code>.</p>
<p>If you want to make changes to a shipped color variant, create a copy in your site’s <code>static/css</code> directory. Don’t edit the file in the theme’s directory!</p>
</div>
</div>
<h3id="multiple-variants">Multiple Variants</h3>
<p>You can also set multiple variants. In this case, the first variant is the default chosen on first view and a variant selector will be shown in the menu footer if the array contains more than one entry.</p>
<p>The theme provides an advanced configuration mode, combining the functionality for multiple variants with the below possibilities of adjusting to your OS settings, logo and syntax highlightning and even more!</p>
<p>Although all options documented here are still working, the advanced configuration options are the recommended way to configure your color variants. <ahref="#theme-variant-advanced">See below</a>.</p>
</div>
</div>
<h2id="adjust-to-os-settings">Adjust to OS Settings</h2>
<p>You can also cause the site to adjust to your OS settings for light/dark mode. Just set the <code>themeVariant</code> to <code>auto</code> to become an auto mode variant. That’s it.</p>
<p>You can use the <code>auto</code> value with the single or multiple variants option. If you are using multiple variants, you can drop <code>auto</code> at any position in the option’s array, but usually it makes sense to set it in the first position and make it the default.</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">themeVariant</span><spanclass="p">=</span><spanclass="p">[</span><spanclass="s2">"auto"</span><spanclass="p">,</span><spanclass="s2">"red"</span><spanclass="p">]</span></span></span></code></pre></div><p>If you don’t configure anything else, the theme will default to use <code>relearn-light</code> for light mode and <code>relearn-dark</code> for dark mode. These defaults are overwritten by the first two non-auto options of your <code>themeVariant</code> option if present.</p>
<p>In the above example, you would end with <code>red</code> for light mode and the default of <code>relearn-dark</code> for dark mode.</p>
<p>If you don’t like that behavior, you can explicitly set <code>themeVariantAuto</code>. The first entry in the array is the color variant for light mode, the second for dark mode.</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">themeVariantAuto</span><spanclass="p">=</span><spanclass="p">[</span><spanclass="s2">"learn"</span><spanclass="p">,</span><spanclass="s2">"neon"</span><spanclass="p">]</span></span></span></code></pre></div><h2id="change-the-favicon">Change the Favicon</h2>
<p>If your favicon is a SVG, PNG or ICO, just drop your image in your site’s <code>static/images/</code> directory and name it <code>favicon.svg</code>, <code>favicon.png</code> or <code>favicon.ico</code> respectively.</p>
<p>If you want to adjust your favicon according to your OS settings for light/dark mode, add the image files <code>static/images/favicon-light.svg</code> and <code>static/images/favicon-dark.svg</code> to your site’s directory, respectively, corresponding to your file format. In case some of the files are missing, the theme falls back to <code>favicon.svg</code> for each missing file. All supplied favicons must be of the same file format.</p>
<p>If no favicon file is found, the theme will lookup the alternative filename <code>logo</code> in the same location and will repeat the search for the list of supported file types.</p>
<p>If you need to change this default behavior, create a new file <code>layouts/partials/favicon.html</code> in your site’s directory and write something like this:</p>
<divclass="wrap-code highlight"><pretabindex="0"class="chroma"><codeclass="language-html"data-lang="html"><spanclass="line"><spanclass="cl"><spanclass="p"><</span><spanclass="nt">link</span><spanclass="na">rel</span><spanclass="o">=</span><spanclass="s">"icon"</span><spanclass="na">href</span><spanclass="o">=</span><spanclass="s">"/images/favicon.bmp"</span><spanclass="na">type</span><spanclass="o">=</span><spanclass="s">"image/bmp"</span><spanclass="p">></span></span></span></code></pre></div><h2id="change-the-logo">Change the Logo</h2>
<p>Create a new file in <code>layouts/partials/logo.html</code> of your site. Then write any HTML you want. You could use an <code>img</code> HTML tag and reference an image created under the <em>static</em> folder, or you could paste a SVG definition!</p>
<p>If you want to switch the syntax highlighting theme together with your color variant, generate a syntax highlighting stylesheet and configure your installation <ahref="https://gohugo.io/content-management/syntax-highlighting/"target="_blank">according to Hugo’s documentation</a>. Then, <code>@import</code> the syntax highlightning stylesheet in your color variant stylesheet.</p>
<p>For an example, take a look into <code>theme-relearn-light.css</code> and <code>config.toml</code> of the exampleSite.</p>
<p>If you want to reconfigure just the syntax highlighting of an existing color variant, you need to copy the file to your site’s directory and adjust it accordingly.</p>
<h2id="theme-variant-advanced">Change the Variant (Advanced)</h2>
<p>The theme offers a new way to configure theme variants and all of the aspects above inside of a single configuration item. This comes with some features previously unsupported.</p>
<p>Like with the <ahref="#multiple-variants">multiple variants</a> option, you are defining your theme variants in an array but now <em>not by simple strings</em><strong>but in a table with suboptions</strong>.</p>
<p>Again, in this case, the first variant is the default chosen on first view and a variant selector will be shown in the menu footer if the array contains more than one entry.</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">themeVariant</span><spanclass="p">=</span><spanclass="p">[</span><spanclass="s2">"relearn-light"</span><spanclass="p">,</span><spanclass="s2">"relearn-dark"</span><spanclass="p">]</span></span></span></code></pre></div><p>you now write it that way:</p>
</span></span><spanclass="line"><spanclass="cl"><spanclass="nx">identifier</span><spanclass="p">=</span><spanclass="s2">"relearn-dark"</span></span></span></code></pre></div><p>The <code>identifier</code> option is mandatory and equivalent to the string in the first example. Further options can be configured, see the table below.</p>
<h3id="parameter">Parameter</h3>
<table>
<thead>
<tr>
<th>Name</th>
<th>Default</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td>identifier</td>
<td><em><empty></em></td>
<td>Must correspond to the name of a color variant either in your site’s or the theme’s directory in the form <code>static/css/theme-<IDENTIFIER>.css</code>.</td>
</tr>
<tr>
<td>name</td>
<td>see notes</td>
<td>The name to be displayed in the variant selector. If not set, the identifier is used in a human readable form.</td>
<td>If set, the variant is treated as an <ahref="#adjust-to-os-settings">auto mode variant</a>. It has the same behavior as the <code>themeVariantAuto</code> option. The first entry in the array is the color variant for light mode, the second for dark mode. Defining auto mode variants with the advanced options has the benefit that you can now have multiple auto mode variants instead of just one with the simple options.</td>