dashy/docs/theming/index.html

19 lines
45 KiB
HTML

<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-beta.2">
<link rel="search" type="application/opensearchdescription+xml" title="Dashy" href="/opensearch.xml">
<script src="https://no-track.as93.net/js/script.js" defer="defer" data-domain="dashy.to"></script><title data-react-helmet="true">Theming | Dashy</title><meta data-react-helmet="true" property="og:url" content="https://dashy.to/docs/theming"><meta data-react-helmet="true" name="docsearch:language" content="en"><meta data-react-helmet="true" name="docsearch:version" content="current"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:title" content="Theming | Dashy"><meta data-react-helmet="true" name="description" content="By default Dashy comes with 25+ built-in themes, which can be applied from the dropdown menu in the UI."><meta data-react-helmet="true" property="og:description" content="By default Dashy comes with 25+ built-in themes, which can be applied from the dropdown menu in the UI."><link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.ico"><link data-react-helmet="true" rel="canonical" href="https://dashy.to/docs/theming"><link data-react-helmet="true" rel="alternate" href="https://dashy.to/docs/theming" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://dashy.to/docs/theming" hreflang="x-default"><link data-react-helmet="true" rel="preconnect" href="https://BH4D9OD16A-dsn.algolia.net" crossorigin="anonymous"><link rel="stylesheet" href="/assets/css/styles.de060916.css">
<link rel="preload" href="/assets/js/runtime~main.ac7349e8.js" as="script">
<link rel="preload" href="/assets/js/main.d13b237a.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"dark")}()</script><div id="__docusaurus">
<div><a href="#main" class="skipToContent_OuoZ">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><img src="/img/dashy.png" alt="Dashy Logo" class="themedImage_TMUO themedImage--light_4Vu1 navbar__logo"><img src="/img/dashy.png" alt="Dashy Logo" class="themedImage_TMUO themedImage--dark_uzRr navbar__logo"><b class="navbar__title">Dashy</b></a><a href="https://github.com/lissy93/dashy" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub</a><a href="https://demo.dashy.to" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Live Demo</a><a class="navbar__item navbar__link" href="/docs/quick-start">Quick Start</a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs">Documentation</a></div><div class="navbar__items navbar__items--right"><div class="react-toggle displayOnlyInLargeViewport_cxYs react-toggle--checked react-toggle--disabled"><div class="react-toggle-track" role="button" tabindex="-1"><div class="react-toggle-track-check"><span class="toggle_iYfV">🌙</span></div><div class="react-toggle-track-x"><span class="toggle_iYfV">☀️</span></div><div class="react-toggle-thumb"></div></div><input type="checkbox" checked="" class="react-toggle-screenreader-only" aria-label="Switch between dark and light mode"></div><div class="searchBox_Bc3W"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img src="/img/dashy.png" alt="Dashy Logo" class="themedImage_TMUO themedImage--light_4Vu1 navbar__logo"><img src="/img/dashy.png" alt="Dashy Logo" class="themedImage_TMUO themedImage--dark_uzRr navbar__logo"><b class="navbar__title">Dashy</b></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a href="https://github.com/lissy93/dashy" target="_blank" rel="noopener noreferrer" class="menu__link">GitHub</a></li><li class="menu__list-item"><a href="https://demo.dashy.to" target="_blank" rel="noopener noreferrer" class="menu__link">Live Demo</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/quick-start">Quick Start</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link navbar__link--active" href="/docs">Documentation</a></li></ul></div></div></div></nav><div class="main-wrapper docs-wrapper doc-page"><div class="docPage_lDyR"><aside class="docSidebarContainer_0YBq"><div class="sidebar_LIo8"><nav class="menu menu--responsive thin-scrollbar menu_oAhv menuWithAnnouncementBar_IVfW" aria-label="Sidebar navigation"><button aria-label="Open menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg class="sidebarMenuIcon_nrF-" width="24" height="24" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Running Dashy</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/quick-start">Quick Start</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/deployment">Deployment</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/configuring">Configuring</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/management">App Management</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/troubleshooting">Troubleshooting</a></li></ul></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">Feature Docs</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/icons">Icons</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/widgets">Widgets</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" tabindex="0" href="/docs/theming">Theming</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/status-indicators">Status Indicators</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/authentication">Authentication</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/searching">Keyboard Shortcuts</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/alternate-views">Alternate Views &amp; Opening Methods</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/multi-language-support">Internationalization</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/backup-restore">Cloud Backup and Restore</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/pages-and-sections">Pages and Sections</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Community</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/showcase">*Dashy Showcase* 🌟</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/contributing">Contributing</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/developing">Developing</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/development-guides">Development Guides</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Misc</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/privacy">Privacy &amp; Security</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/changelog">Changelog</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/license">license</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/code-of-conduct">Contributor Covenant Code of Conduct</a></li></ul></li></ul></nav><div class="sidebar-ad"><script async="" src="//cdn.carbonads.com/carbon.js?serve=CWYIC53L&amp;placement=dashyto" id="_carbonads_js"></script></div></div></aside><main class="docMainContainer_r8cw"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_zHA2"><div class="docItemContainer_oiyr"><article><div class="markdown"><header><h1 class="h1Heading_dC7a">Theming</h1></header><p>By default Dashy comes with 25+ built-in themes, which can be applied from the dropdown menu in the UI.</p><p><img src="https://i.ibb.co/GV3wRss/Dashy-Themes.png" alt="Built-in Themes"></p><p>You can also add your own themes, apply custom styles, and modify colors.</p><p>You can customize Dashy by writing your own CSS, which can be loaded either as an external stylesheet, set directly through the UI, or specified in the config file. Most styling options can be set through CSS variables, which are outlined below.</p><p>The following content requires that you have a basic understanding of CSS. If you&#x27;re just beginning, you may find <a href="https://developer.mozilla.org/en-US/docs/Learn/CSS/First_steps" target="_blank" rel="noopener noreferrer">this article</a> helpful.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="how-theme-switching-works"></a>How Theme-Switching Works<a class="hash-link" href="#how-theme-switching-works" title="Direct link to heading">#</a></h2><p>The theme switching is done by simply changing the <code>data-theme</code> attribute on the root DOM element, which can then be targeted by CSS. First off, in order for the theme to show up in the theme switcher, it needs to be added to the config file, under <code>appConfig.cssThemes</code>, either as a string, or an array of strings for multiple themes. For example:</p><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI yaml"><pre tabindex="0" class="prism-code language-yaml codeBlock_rtdJ thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#F8F8F2"><span class="token key atrule">appConfig</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">cssThemes</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;tiger&#x27;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;another-theme&#x27;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><p>You can now create a block to target you&#x27;re theme with <code>html[data-theme=&#x27;my-theme&#x27;]{}</code> and set some styles. The easiest method is by setting CSS variables, but you can also directly override elements by their selector. As an example, see the <a href="https://github.com/Lissy93/dashy/blob/master/src/styles/color-themes.scss" target="_blank" rel="noopener noreferrer">built-in CSS themes</a>.</p><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI css"><pre tabindex="0" class="prism-code language-css codeBlock_rtdJ thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#F8F8F2"><span class="token selector" style="color:rgb(255, 121, 198)">html</span><span class="token selector attribute punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token selector attribute attr-name" style="color:rgb(241, 250, 140)">data-theme</span><span class="token selector attribute operator" style="color:rgb(255, 121, 198)">=</span><span class="token selector attribute attr-value" style="color:rgb(255, 121, 198)">&#x27;tiger&#x27;</span><span class="token selector attribute punctuation" style="color:rgb(248, 248, 242)">]</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token variable" style="color:rgb(189, 147, 249);font-style:italic">--primary</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token hexcode color">#f58233</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token variable" style="color:rgb(189, 147, 249);font-style:italic">--background</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token hexcode color">#0b1021</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"></span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><p>Finally, from the UI use the theme dropdown menu to select your new theme, and your styles will be applied.</p><p>You can also set <code>appConfig.theme</code> to pre-select a default theme, which will be applied immediately after deployment.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="modifying-theme-colors"></a>Modifying Theme Colors<a class="hash-link" href="#modifying-theme-colors" title="Direct link to heading">#</a></h2><p>Themes can be modified either through the UI, using the color picker menu (to the right of the theme dropdown), or directly in the config file, under <code>appConfig.customColors</code>. Here you can specify the value for any of the <a href="#css-variables">available CSS variables</a>.</p><p align="center"><a href="https://i.ibb.co/cLDXj1R/dashy-theme-configurator.gif" target="_blank" rel="noopener noreferrer"><img alt="Example Themes" src="https://raw.githubusercontent.com/Lissy93/dashy/master/docs/assets/theme-config-demo.gif" width="400"></a></p><p>By default, any color modifications made to the current theme through the UI will only be applied locally. If you need these settings to be set globally, then click the &#x27;Export&#x27; button, to get the color codes and variable names, which can then be backed up, or saved in your config file.</p><p>Custom colors are saved relative the the base theme selected. So if you switch themes after setting custom colors, then you&#x27;re settings will no longer be applied. You&#x27;re changes are not lost though, and switching back to the original theme will see your styles reapplied.</p><p>If these values are specified in your <code>conf.yml</code> file, then it will look something like the below example. Note that in YAML, values or keys which contain special characters, must be wrapped in quotes.</p><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI yaml"><pre tabindex="0" class="prism-code language-yaml codeBlock_rtdJ thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#F8F8F2"><span class="token key atrule">appConfig</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">customColors</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">oblivion</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">primary</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;#75efff&#x27;</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">background</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;#2a3647&#x27;</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">dracula</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">primary</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;#8be9fd&#x27;</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="adding-your-own-theme"></a>Adding your own Theme<a class="hash-link" href="#adding-your-own-theme" title="Direct link to heading">#</a></h2><p>User-defined styles and custom themes should be defined in <code>./src/styles/user-defined-themes.scss</code>. If you&#x27;re using Docker, you can pass your own stylesheet in using the <code>--volume</code> flag. E.g. <code>v ./my-themes.scss:/app/src/styles/user-defined-themes.scss</code>. Don&#x27;t forget to pass your theme name into <code>appConfig.cssThemes</code> so that it shows up on the theme-switcher dropdown.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="setting-custom-css-in-the-ui"></a>Setting Custom CSS in the UI<a class="hash-link" href="#setting-custom-css-in-the-ui" title="Direct link to heading">#</a></h2><p>Custom CSS can be developed, tested and applied directly through the UI. Although you will need to make note of your changes to apply them across instances.</p><p>This can be done from the Config menu (spanner icon in the top-right), under the Custom Styles tab. This is then associated with <code>appConfig.customCss</code> in local storage. Styles can also be directly applied to this attribute in the config file, but this may get messy very quickly if you have a lot of CSS.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="page-specific-styles"></a>Page-Specific Styles<a class="hash-link" href="#page-specific-styles" title="Direct link to heading">#</a></h2><p>If you&#x27;ve got multiple pages within your dashboard, you can choose to target certain styles to specific pages. The top-most element within <code>&lt;body&gt;</code> will have a class name specific to the current sub-page. This is usually the page&#x27;s name, all lowercase, with dashes instead of spaces, but you can easily check this yourself within the dev tools.</p><p>For example, if the pages name was &quot;CFT Toolbox&quot;, and you wanted to target <code>.item</code>s, you would do:</p><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI css"><pre tabindex="0" class="prism-code language-css codeBlock_rtdJ thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#F8F8F2"><span class="token selector class" style="color:rgb(255, 121, 198)">.cft-toolbox</span><span class="token selector" style="color:rgb(255, 121, 198)"> </span><span class="token selector class" style="color:rgb(255, 121, 198)">.item</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">{</span><span class="token plain"> </span><span class="token property">border</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token number">4</span><span class="token unit">px</span><span class="token plain"> solid </span><span class="token color">yellow</span><span class="token punctuation" style="color:rgb(248, 248, 242)">;</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">}</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="loading-external-stylesheets"></a>Loading External Stylesheets<a class="hash-link" href="#loading-external-stylesheets" title="Direct link to heading">#</a></h2><p>The URI of a stylesheet, either local or hosted on a remote CDN can be passed into the config file. The attribute <code>appConfig.externalStyleSheet</code> accepts either a string, or an array of strings. You can also pass custom font stylesheets here, they must be in a CSS format (for example, <code>https://fonts.googleapis.com/css2?family=Cutive+Mono</code>).
This is handled in <a href="https://github.com/Lissy93/dashy/blob/master/src/utils/ThemeHelper.js" target="_blank" rel="noopener noreferrer"><code>ThemeHelper.js</code></a>.</p><p>For example:</p><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI yaml"><pre tabindex="0" class="prism-code language-yaml codeBlock_rtdJ thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#F8F8F2"><span class="token key atrule">appConfig</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">externalStyleSheet</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;https://example.com/my-stylesheet.css&#x27;</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><div class="codeBlockContainer_J+bg"><div class="codeBlockContent_csEI yaml"><pre tabindex="0" class="prism-code language-yaml codeBlock_rtdJ thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_1zSZ"><span class="token-line" style="color:#F8F8F2"><span class="token key atrule">appConfig</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">externalStyleSheet</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">[</span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;/themes/my-theme-1.css&#x27;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">,</span><span class="token plain"> </span><span class="token string" style="color:rgb(255, 121, 198)">&#x27;/themes/my-theme-2.css&#x27;</span><span class="token punctuation" style="color:rgb(248, 248, 242)">]</span></span></code></pre><button type="button" aria-label="Copy code to clipboard" class="copyButton_M3SB clean-btn">Copy</button></div></div><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="hard-coding-section-or-item-colors"></a>Hard-Coding Section or Item Colors<a class="hash-link" href="#hard-coding-section-or-item-colors" title="Direct link to heading">#</a></h2><p>Some UI components have a color option, that can be set in the config file, to force the color of a given item or section no matter what theme is selected. These colors should be expressed as hex codes (e.g. <code>#fff</code>) or HTML colors (e.g. <code>red</code>). The following attributes are supported:</p><ul><li><code>section.color</code> - Custom color for a given section</li><li><code>item.color</code> - Font and icon color for a given item</li><li><code>item.backgroundColor</code> - Background color for a given icon</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="typography"></a>Typography<a class="hash-link" href="#typography" title="Direct link to heading">#</a></h2><p>Essential fonts bundled within the app are located within <code>./src/assets/fonts/</code>. All optional fonts that are used by themes are stored in <code>./public/fonts/</code>, if you want to add your own font, this is where you should put it. As with assets, if you&#x27;re using Docker then using a volume to link a directory on your host system with this path within the container will make management much easier.</p><p>Fonts which are not being used by the current theme are <strong>not</strong> fetched on page load. They are instead only loaded into the application if and when they are required. So having multiple themes with various typefaces shouldn&#x27;t have any negative impact on performance.</p><p>Full credit to the typographers behind each of the included fonts. Specifically: Matt McInerney, Christian Robertson, Haley Fiege, Peter Hull, Cyreal and the legendary Vernon Adams</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="css-variables"></a>CSS Variables<a class="hash-link" href="#css-variables" title="Direct link to heading">#</a></h2><p>All colors as well as other variable values (such as borders, border-radius, shadows) are specified as CSS variables. This makes theming the application easy, as you only need to change a given color or value in one place. You can find all variables in <a href="https://github.com/Lissy93/dashy/blob/master/src/styles/color-palette.scss" target="_blank" rel="noopener noreferrer"><code>color-palette.scss</code></a> and the themes which make use of these color variables are specified in <a href="https://github.com/Lissy93/dashy/blob/master/src/styles/color-themes.scss" target="_blank" rel="noopener noreferrer"><code>color-themes.scss</code></a></p><p>CSS variables are simple to use. You define them like: <code>--background: #fff;</code> and use them like: <code>body { background-color: var(--background); }</code>. For more information, see this guide on using <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties" target="_blank" rel="noopener noreferrer">CSS Variables</a>.</p><p>You can determine the variable used by any given element, and visualize changes using the browser developer tools (Usually opened with <code>F12</code>, or Options --&gt; More --&gt; Developer Tools). Under the elements tab, click the Element Selector icon (usually top-left corner), you will then be able to select any DOM element on the page by hovering and clicking it. In the CSS panel you will see all styles assigned to that given element, including CSS variables. Click a variable to see it&#x27;s parent value, and for color attributes, click the color square to modify the color. For more information, see this <a href="https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools" target="_blank" rel="noopener noreferrer">getting started guide</a>, and these articles on <a href="https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Select_an_element" target="_blank" rel="noopener noreferrer">selecting elements</a> and <a href="https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Inspect_and_select_colors" target="_blank" rel="noopener noreferrer">inspecting and modifying colors</a>.</p><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="top-level-variables"></a>Top-Level Variables<a class="hash-link" href="#top-level-variables" title="Direct link to heading">#</a></h3><p>These are all that are required to create a theme. All other variables inherit their values from these variables, and can optionally be overridden.</p><ul><li><code>--primary</code> - Application primary color. Used for title, text, accents, and other features</li><li><code>--background</code> - Application background color</li><li><code>--background-darker</code> - Secondary background color (usually darker), used for navigation bar, section fill, footer etc</li><li><code>--curve-factor</code> - The border radius used globally throughout the application. Specified in <code>px</code>, defaults to <code>5px</code></li><li><code>--dimming-factor</code> - Inactive elements have slight transparency. This can be between <code>0</code> (invisible) and <code>1</code> (normal), defaults to <code>0.7</code></li></ul><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="targeted-color-variables"></a>Targeted Color Variables<a class="hash-link" href="#targeted-color-variables" title="Direct link to heading">#</a></h3><p>You can target specific elements on the UI with these variables. All are optional, since by default, they inherit their values from above</p><ul><li><code>--heading-text-color</code> - Text color for web page heading and sub-heading. Defaults to <code>--primary</code></li><li><code>--nav-link-text-color</code> - The text color for links displayed in the navigation bar. Defaults to <code>--primary</code></li><li><code>--nav-link-background-color</code> - The background color for links displayed in the navigation bar</li><li><code>--nav-link-text-color-hover</code> - The text color when a navigation bar link is hovered over. Defaults to <code>--primary</code></li><li><code>--nav-link-background-color-hover</code> - The background color for nav bar links when hovered over</li><li><code>--nav-link-border-color</code> - The border color for nav bar links. Defaults to <code>transparent</code></li><li><code>--nav-link-border-color-hover</code> - The border color for nav bar links when hovered over. Defaults to <code>--primary</code></li><li><code>--search-container-background</code> - Background for the container containing the search bar. Defaults to <code>--background-darker</code></li><li><code>--search-field-background</code> - Fill color for the search bar. Defaults to <code>--background</code></li><li><code>--settings-background</code> - The background for the quick settings. Defaults to <code>--background</code></li><li><code>--settings-text-color</code> - The text and icon color for quick settings. Defaults to <code>--primary</code></li><li><code>--footer-text-color</code> - Color for text within the footer. Defaults to <code>--medium-grey</code></li><li><code>--footer-text-color-link</code> - Color for any hyperlinks within the footer. Defaults to <code>--primary</code></li><li><code>--item-text-color</code> - The text and icon color for items. Defaults to <code>--primary</code></li><li><code>--item-group-outer-background</code> - The background color for the outer part of a section (including section head). Defaults to <code>--primary</code></li><li><code>--item-group-background</code> - The background color for the inner part of item groups. Defaults to <code>#0b1021cc</code> (semi-transparent black)</li><li><code>--item-group-heading-text-color</code> - The text color for section headings. Defaults to <code>--item-group-background</code>;</li><li><code>--item-group-heading-text-color-hover</code> - The text color for section headings, when hovered. Defaults to <code>--background</code></li><li><code>--config-code-background</code> - Background color for the JSON editor in the config menu. Defaults to <code>#fff</code> (white)</li><li><code>--config-code-color</code> - Text color for the non-highlighted code within the JSON editor. Defaults to <code>--background</code></li><li><code>--config-settings-color</code> - The background for the config/ settings pop-up modal. Defaults to <code>--primary</code></li><li><code>--config-settings-background</code> - The text color for text within the settings container. Defaults to <code>--background-darker</code></li><li><code>--scroll-bar-color</code> - Color of the scroll bar thumb. Defaults to <code>--primary</code></li><li><code>--scroll-bar-background</code> Color of the scroll bar blank space. Defaults to <code>--background-darker</code></li><li><code>--highlight-background</code> Fill color for text highlighting. Defaults to <code>--primary</code></li><li><code>--highlight-color</code> Text color for selected/ highlighted text. Defaults to <code>--background</code></li><li><code>--toast-background</code> - Background color for the toast info popup. Defaults to <code>--primary</code></li><li><code>--toast-color</code> - Text, icon and border color in the toast info popup. Defaults to <code>--background</code></li><li><code>--welcome-popup-background</code> - Background for the info pop-up shown on first load. Defaults to <code>--background-darker</code></li><li><code>--welcome-popup-text-color</code> - Text color for the welcome pop-up. Defaults to <code>--primary</code></li><li><code>--side-bar-background</code> - Background color of the sidebar used in the workspace view. Defaults to <code>--background-darker</code></li><li><code>--side-bar-color</code> - Color of icons and text within the sidebar. Defaults to <code>--primary</code></li><li><code>--status-check-tooltip-background</code> - Background color for status check tooltips. Defaults to <code>--background-darker</code></li><li><code>--status-check-tooltip-color</code> - Text color for the status check tooltips. Defaults to <code>--primary</code></li><li><code>--code-editor-color</code> - Text color used within raw code editors. Defaults to <code>--black</code></li><li><code>--code-editor-background</code> - Background color for raw code editors. Defaults to <code>--white</code></li><li><code>--context-menu-color</code> - Text color for right-click context menu over items. Defaults to <code>--primary</code></li><li><code>--context-menu-background</code> - Background color of right-click context menu. Defaults to <code>--background</code></li><li><code>--context-menu-secondary-color</code> - Border and outline color for context menu. Defaults to <code>--background-darker</code></li></ul><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="non-color-variables"></a>Non-Color Variables<a class="hash-link" href="#non-color-variables" title="Direct link to heading">#</a></h3><ul><li><code>--outline-color</code> - Used to outline focused or selected elements</li><li><code>--curve-factor-navbar</code> - The border radius of the navbar. Usually this is greater than <code>--curve-factor</code></li><li><code>--scroll-bar-width</code> - Width of horizontal and vertical scroll bars. E.g. <code>8px</code></li><li><code>--item-group-padding</code> - Inner padding of sections, determines the width of outline. E.g. <code>5px</code></li><li><code>--item-shadow</code> - Shadow for items. E.g. <code>1px 1px 2px #130f23</code></li><li><code>--item-hover-shadow</code> - Shadow for items when hovered over. E.g. <code>1px 2px 4px #373737</code></li><li><code>--item-icon-transform</code> - A <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform" target="_blank" rel="noopener noreferrer">transform</a> property, to modify item icons. E.g. <code>drop-shadow(2px 4px 6px var(--transparent-50)) saturate(0.65)</code></li><li><code>--item-icon-transform-hover</code> - Same as above, but applied when an item is hovered over. E.g. <code>drop-shadow(4px 8px 3px var(--transparent-50)) saturate(2)</code></li><li><code>--item-group-shadow</code> - The shadow for an item group/ section. Defaults to <code>--item-shadow</code></li><li><code>--settings-container-shadow</code> - A shadow property for the settings container. E.g. <code>none</code></li></ul><h3><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_WiXH" id="action-colors"></a>Action Colors<a class="hash-link" href="#action-colors" title="Direct link to heading">#</a></h3><p>These colors represent intent, and so are not often changed, but you can do so if you wish</p><ul><li><code>--info</code> - Information color, usually blue / <code>#04e4f4</code></li><li><code>--success</code> - Success color, usually green / <code>#20e253</code></li><li><code>--warning</code> - Warning color, usually yellow / <code>#f6f000</code></li><li><code>--danger</code> - Error/ danger color, usually red / <code>#f80363</code></li><li><code>--neutral</code> - Neutral color, usually grey / <code>#272f4d</code></li><li><code>--white</code> - Just white / <code>#fff</code></li><li><code>--black</code> - Just black / <code>#000</code></li></ul></div><footer class="row docusaurus-mt-lg"><div class="col"><a href="https://github.com/Lissy93/dashy/edit/gh-pages/docs/docs/theming.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_mS5F" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_wj+Z"></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/widgets"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« Widgets</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/status-indicators"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Status Indicators »</div></a></div></nav></div></div><div class="col col--3"><div class="tableOfContents_vrFS thin-scrollbar"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#how-theme-switching-works" class="table-of-contents__link">How Theme-Switching Works</a></li><li><a href="#modifying-theme-colors" class="table-of-contents__link">Modifying Theme Colors</a></li><li><a href="#adding-your-own-theme" class="table-of-contents__link">Adding your own Theme</a></li><li><a href="#setting-custom-css-in-the-ui" class="table-of-contents__link">Setting Custom CSS in the UI</a></li><li><a href="#page-specific-styles" class="table-of-contents__link">Page-Specific Styles</a></li><li><a href="#loading-external-stylesheets" class="table-of-contents__link">Loading External Stylesheets</a></li><li><a href="#hard-coding-section-or-item-colors" class="table-of-contents__link">Hard-Coding Section or Item Colors</a></li><li><a href="#typography" class="table-of-contents__link">Typography</a></li><li><a href="#css-variables" class="table-of-contents__link">CSS Variables</a><ul><li><a href="#top-level-variables" class="table-of-contents__link">Top-Level Variables</a></li><li><a href="#targeted-color-variables" class="table-of-contents__link">Targeted Color Variables</a></li><li><a href="#non-color-variables" class="table-of-contents__link">Non-Color Variables</a></li><li><a href="#action-colors" class="table-of-contents__link">Action Colors</a></li></ul></li></ul></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Intro</div><ul class="footer__items"><li class="footer__item"><a href="https://github.com/lissy93/dashy" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li><li class="footer__item"><a href="https://demo.dashy.to" target="_blank" rel="noopener noreferrer" class="footer__link-item">Live Demo</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/quick-start">Quick Start</a></li><li class="footer__item"><a class="footer__link-item" href="/docs">Documentation</a></li></ul></div><div class="col footer__col"><div class="footer__title">Setup Guide</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/deployment">Deploying</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/configuring">Configuring</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/management">Management</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/troubleshooting">Troubleshooting</a></li></ul></div><div class="col footer__col"><div class="footer__title">Feature Docs Pt 1</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/authentication">Authentication</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/alternate-views">Alternate Views</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/backup-restore">Backup &amp; Restore</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/icons">Icons</a></li></ul></div><div class="col footer__col"><div class="footer__title">Feature Docs Pt 2</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/multi-language-support">Language Switching</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/status-indicators">Status Indicators</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/searching">Searching &amp; Shortcuts</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/theming">Theming</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/developing">Developing</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/development-guides">Development Guides</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/contributing">Contributing</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/showcase">Showcase</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/credits">Credits</a></li></ul></div><div class="col footer__col"><div class="footer__title">Misc</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/privacy">Privacy &amp; Security</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/license">License</a></li><li class="footer__item"><a href="https://github.com/Lissy93/dashy/blob/master/.github/LEGAL.md" target="_blank" rel="noopener noreferrer" class="footer__link-item">Legal</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/code-of-conduct">Code of Conduct</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/changelog">Changelog</a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright"><a href="https://dashy.to">Dashy</a> - The Self-Hosted Dashboard for your Homelab<br>License under <a href="https://github.com/Lissy93/dashy/blob/master/LICENSE">MIT</a>. Copyright © 2024 <a href="https://aliciasykes.com">Alicia Sykes</a></div></div></div></footer></div>
<script src="/assets/js/runtime~main.ac7349e8.js"></script>
<script src="/assets/js/main.d13b237a.js"></script>
</body>
</html>