Skip to content

armgit / dashy

Public Imported from GitHub
0

🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

✨ Adds ability to set favicon and address bar color

Alicia Sykes7341bacfb06e
diff --git a/docs/configuring.md b/docs/configuring.md
index ca4625ec..08d529ae 100644
--- a/docs/configuring.md
+++ b/docs/configuring.md
@@ -75,6 +75,8 @@ The following file provides a reference of all supported configuration options.
**`navLinks`** | `array` | _Optional_ | Optional list of a maximum of 6 links, which will be displayed in the navigation bar. See [`navLinks`](#pageinfonavlinks-optional)
**`footer`** | `string` | _Optional_ | Text to display in the footer. When omitted, no footer is rendered. Supports inline HTML (sanitized before render)
**`logo`** | `string` | _Optional_ | The path to an image to display in the header (to the right of the title). This can be either local, where `/` is the root of `./public`, or any remote image, such as `https://i.ibb.co/yhbt6CY/dashy.png`. It's recommended to scale your image down, so that it doesn't impact load times
+**`favicon`** | `string` | _Optional_ | URL or path to a custom favicon shown in the browser tab. Can be absolute (`https://...`), root-relative (`/icons/x.png`), or a `data:` URI
+**`color`** | `string` | _Optional_ | Theme colour applied to the browser chrome (mobile address bar). Any valid CSS color (e.g. `#ff00a7`) is accepted
**[⬆️ Back to Top](#configuring)**
diff --git a/docs/pages-and-sections.md b/docs/pages-and-sections.md
index 41936995..7b6cfbdb 100644
--- a/docs/pages-and-sections.md
+++ b/docs/pages-and-sections.md
@@ -1,5 +1,23 @@
# Pages and Sections
+## Page Metadata
+
+Set your dashboard's branding under `pageInfo`
+
+```yaml
+pageInfo:
+ title: My Dashboard # Used for main h1 title, and browser tab text
+ description: Home server links
+ logo: /web-icons/my-logo.png # path/URL to optional logo to display next to title
+ favicon: 'https://example.com/path/to/icon' # path/URL to a favicon (shows in browser tab)
+ color: '#2a7cf0' # Hex color, to set the browser/address bar color on mobile (supported browsers only)
+ footer: '© 2026 Me' # Optional text or HTML content, to display in the pages footer
+```
+
+If you have multiple configs/pages, then these values swap automatically as you navigate between sub-pages.
+
+The only caveat being, if you install Dashy as a PWA, the installed app's name, icon, and splash-screen colour come from the bundled `manifest.webmanifest` (baked at build time) rather than `pageInfo`. Runtime values only apply when browsing in a regular tab or browser.
+
## Multi-Page Support
You can have additional pages within your dashboard, with each having it's own config file. The config files for sub-pages can either be stored locally, or hosted separately. A link to each additional page will be displayed in the navigation bar.
diff --git a/docs/theming.md b/docs/theming.md
index e538a91e..f4567966 100644
--- a/docs/theming.md
+++ b/docs/theming.md
@@ -111,6 +111,10 @@ Fonts which are not being used by the current theme are **not** fetched on page
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
+## Changing browser address bar / tab color
+
+Some browsers support setting a color, which will apply a tint to the address bar, and task switcher card title bar. To enable this, set `pageInfo.color` to any valid CSS color (e.g. `#ff00a7`, `rebeccapurple`, `rgb(40, 60, 120)`). Note that browser support for this is still limited (Android Chrome, Safari iOS 15+ and some recent mobile Chromium browsers). This does not apply if you've installed the PWA. For more page-specific browser and UI options, see [Pages and Sections](/docs/pages-and-sections.md).
+
## CSS Variables
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 [`color-palette.scss`](https://github.com/Lissy93/dashy/blob/master/src/styles/color-palette.scss) and the themes which make use of these color variables are specified in [`color-themes.scss`](https://github.com/Lissy93/dashy/blob/master/src/styles/color-themes.scss)
diff --git a/src/utils/PageMeta.js b/src/utils/PageMeta.js
index 4b9a90c9..cfbf116f 100644
--- a/src/utils/PageMeta.js
+++ b/src/utils/PageMeta.js
@@ -3,6 +3,7 @@
*/
import { makePageName, viewFromPath } from '@/utils/config/ConfigHelpers';
+import ErrorHandler from '@/utils/logging/ErrorHandler';
const FALLBACK_TITLE = 'Dashy';
@@ -22,6 +23,28 @@ const resolveSectionName = (sectionSlug, sections) => {
return match?.name;
};
+/* Reject bad URLs from favicon path. Only allows URLs, paths and data URI */
+const validateFavicon = (value) => {
+ if (typeof value !== 'string') return null;
+ const url = value.trim();
+ if (!url) return null;
+ if (/^(javascript|vbscript):/i.test(url)) {
+ ErrorHandler(`Unsafe favicon URL rejected: ${value}`);
+ return null;
+ }
+ return url;
+};
+
+/* Uses the browser's own CSS parser as the source of truth for valid color values. */
+const validateColor = (value) => {
+ if (typeof value !== 'string') return null;
+ const color = value.trim();
+ if (!color) return null;
+ if (window.CSS?.supports?.('color', color)) return color;
+ ErrorHandler(`Invalid theme color rejected: ${value}`);
+ return null;
+};
+
/* Compute the metadata object for the current route + store */
export const computePageMeta = (route, store) => {
const staticLabel = STATIC_ROUTE_LABELS[route?.name];
@@ -33,7 +56,12 @@ export const computePageMeta = (route, store) => {
const viewLabel = VIEW_LABELS[view];
const sectionName = resolveSectionName(route?.params?.section, store?.getters?.sections);
const title = [sectionName, base, viewLabel].filter(Boolean).join(' | ') || FALLBACK_TITLE;
- return { title, description: pageInfo.description || '' };
+ return {
+ title,
+ description: pageInfo.description || '',
+ themeColor: validateColor(pageInfo.color),
+ favicon: validateFavicon(pageInfo.favicon),
+ };
};
/* Upsert a <meta name="..."> tag in the document head */
@@ -47,10 +75,26 @@ const setMetaTag = (name, content) => {
tag.setAttribute('content', content || '');
};
-/* Map of meta-field -> DOM writer. Add new entries here to extend. */
+/* Update every <link rel="icon"> href, or create one if none exist */
+const setFavicon = (href) => {
+ const links = document.querySelectorAll('link[rel~="icon"]');
+ if (links.length === 0) {
+ const link = document.createElement('link');
+ link.setAttribute('rel', 'icon');
+ link.setAttribute('href', href);
+ document.head.appendChild(link);
+ return;
+ }
+ links.forEach((l) => l.setAttribute('href', href));
+};
+
+/* Map of meta-field to DOM writer
+ * If sub-page doesn't have an override, it will inherit from root */
const APPLIERS = {
title: (v) => { document.title = v || FALLBACK_TITLE; },
description: (v) => setMetaTag('description', v),
+ themeColor: (v) => { if (v) setMetaTag('theme-color', v); },
+ favicon: (v) => { if (v) setFavicon(v); },
};
/* Side-effect: push a meta object onto the DOM */
diff --git a/src/utils/config/ConfigSchema.json b/src/utils/config/ConfigSchema.json
index a152764b..115b74f6 100644
--- a/src/utils/config/ConfigSchema.json
+++ b/src/utils/config/ConfigSchema.json
@@ -174,6 +174,21 @@
"/web-icons/dashy-logo.png",
"https://i.ibb.co/yhbt6CY/dashy.png"
]
+ },
+ "favicon": {
+ "title": "Favicon",
+ "type": "string",
+ "description": "URL or path to a custom favicon shown in the browser tab. Absolute (https://...), root-relative (/icons/x.png), or a data: URI.",
+ "examples": [
+ "/web-icons/favicon-64x64.png",
+ "https://example.com/favicon.ico"
+ ]
+ },
+ "color": {
+ "title": "Theme Color",
+ "type": "string",
+ "description": "Color applied to the browser chrome (mobile address bar). Any valid CSS color value.",
+ "examples": ["#2a7cf0", "rebeccapurple", "rgb(40, 60, 120)"]
}
},
"required": [