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!

refactor(theme): simplify liquid glass styling

KeuqS31643fdce3d5
diff --git a/docs/development-guides.md b/docs/development-guides.md
index e3bc0372..55343bb5 100644
--- a/docs/development-guides.md
+++ b/docs/development-guides.md
@@ -24,7 +24,8 @@ Choose a snappy name for your theme, and add it to the `builtInThemes` array ins
### 2. Write some Styles
-Put your theme styles in a dedicated partial under [`src/styles/themes/`](https://github.com/Lissy93/dashy/tree/master/src/styles/themes), import it from [`color-themes.scss`](https://github.com/Lissy93/dashy/blob/master/src/styles/color-themes.scss), and make sure that `data-theme` matches the theme name you chose above. For example:
+Put your theme styles inside [`color-themes.scss`](https://github.com/Lissy93/dashy/blob/master/src/styles/color-themes.scss).
+Create a new block, and make sure that `data-theme` matches the theme name you chose above. For example:
```css
html[data-theme='tiger'] {
diff --git a/docs/theming.md b/docs/theming.md
index c5a851dc..2f300b0f 100644
--- a/docs/theming.md
+++ b/docs/theming.md
@@ -1,6 +1,6 @@
# Theming
-By default Dashy comes with 50+ built-in themes, which can be applied from the dropdown menu in the UI.
+By default Dashy comes with 40+ built-in themes, which can be applied from the dropdown menu in the UI.
![Built-in Themes](https://i.ibb.co/GV3wRss/Dashy-Themes.png)
@@ -14,27 +14,9 @@ The following content requires that you have a basic understanding of CSS. If yo
The theme switching is done by simply changing the `data-theme` attribute on the root DOM element, which can then be targeted by CSS. All colors and styles are managed with CSS variables.
-The theme switcher in the UI lists the built-in themes registered in [`src/utils/config/defaults.js`](https://github.com/Lissy93/dashy/blob/master/src/utils/config/defaults.js), as well as any extras that you add under `appConfig.cssThemes`. When a theme is selected, its name is applied to the root `data-theme` attribute and the selection is persisted through Dashy's existing local config storage flow.
-
-To apply a default theme to your instance, set `appConfig.theme` (or, use `dayTheme` and `nightTheme` to adjust according to your OS light/dark preferences).
-
-### Liquid Glass
-
-`liquid-glass` is a built-in glass surface theme that uses the same CSS variable/token system as the other themes. It adds a cool, translucent palette and applies `backdrop-filter` only to bounded chrome surfaces such as the header, settings panel, modals and view switcher. Item cards remain translucent without blur so larger dashboards do not pay the cost of a blur layer for every item.
-
-The theme has several graceful fallbacks:
-
-- Browsers without `backdrop-filter` support receive solid, high-contrast surfaces.
-- `prefers-reduced-motion: reduce` disables transitions and hover transforms.
-- `forced-colors: active` switches to system colors and removes transparency and blur.
-- Touch, narrow, or reduced-data contexts disable blur and reduce shadows.
-
-To use it in `conf.yml`:
-
-```yaml
-appConfig:
- theme: liquid-glass
-```
+The theme switcher in the UI will list all themes defined in [here](github.com/Lissy93/dashy/blob/3.3.1/src/utils/defaults.js#L50), as well as any extras that you add yourself under `appConfig.cssThemes`. Then, when a theme is selected, any CSS within `html[data-theme='my-theme']{}` will be applied.
+
+To apply a default theme to your instance, set `appConfig.theme` (or, use `dayTheme` and `nightTheme` to adjust according to your OS light/dark preferences).
## Adding Your Own Theme
diff --git a/src/styles/themes/_liquid-glass.scss b/src/styles/themes/_liquid-glass.scss
index aa8fabba..56d469d0 100644
--- a/src/styles/themes/_liquid-glass.scss
+++ b/src/styles/themes/_liquid-glass.scss
@@ -1,40 +1,45 @@
-/*
- * Liquid Glass
- *
- * A lightweight glass surface theme. The blur is deliberately restricted to
- * a small set of navigation and modal surfaces; link items stay translucent
- * without backdrop-filter so larger dashboards remain responsive.
- */
+/* Liquid Glass β€” a cool, translucent palette with restrained blur. */
html[data-theme='liquid-glass'] {
--primary: #f1f7ff;
- --foreground: #e8f2ff;
--background: #091426;
--background-darker: #06101f;
- --item-group-outer-background: rgba(12, 28, 52, 0.82);
--item-group-background: rgba(21, 45, 78, 0.58);
- --item-group-heading-text-color: #e8f2ff;
- --item-group-heading-text-color-hover: #ffffff;
- --item-group-shadow: 0 14px 34px rgba(1, 8, 20, 0.28);
+ --item-group-outer-background: rgba(12, 28, 52, 0.82);
+ --item-background: rgba(18, 39, 68, 0.62);
+ --item-background-hover: rgba(47, 83, 128, 0.72);
--item-shadow: 0 8px 22px rgba(1, 8, 20, 0.2);
--item-hover-shadow: 0 12px 28px rgba(1, 8, 20, 0.34);
+
+ --heading-text-color: #e8f2ff;
+ --item-text-color: #e8f2ff;
+ --item-text-color-hover: #ffffff;
+ --item-group-heading-text-color: #e8f2ff;
+ --item-group-heading-text-color-hover: #ffffff;
+
--settings-background: rgba(10, 25, 46, 0.82);
--settings-text-color: #e8f2ff;
+ --nav-link-text-color: #e8f2ff;
+ --nav-link-text-color-hover: #ffffff;
+ --nav-link-background-color: transparent;
+ --nav-link-border-color: rgba(225, 241, 255, 0.22);
+ --nav-link-border-color-hover: rgba(225, 241, 255, 0.4);
--search-container-background: rgba(10, 25, 46, 0.62);
+ --search-field-background: rgba(18, 39, 68, 0.62);
--config-settings-background: #0c1b31;
--cloud-backup-background: #0c1b31;
+ --footer-background: transparent;
+ --footer-text-color: #b8c9df;
+ --footer-text-color-link: #ffffff;
+
--minimal-view-background-color: transparent;
--minimal-view-group-background: rgba(21, 45, 78, 0.58);
--minimal-view-section-heading-background: rgba(21, 45, 78, 0.72);
--minimal-view-section-heading-color: #e8f2ff;
+ --outline-color: rgba(225, 241, 255, 0.6);
+ --highlight-background: rgba(225, 241, 255, 0.22);
+ --highlight-color: #ffffff;
--curve-factor: 0.9rem;
--curve-factor-navbar: 1.1rem;
- --liquid-glass-surface: rgba(18, 39, 68, 0.62);
- --liquid-glass-surface-strong: rgba(12, 29, 52, 0.84);
- --liquid-glass-border: rgba(225, 241, 255, 0.22);
- --liquid-glass-highlight: rgba(255, 255, 255, 0.13);
- --liquid-glass-blur: 14px;
-
- color: var(--foreground);
body {
background-color: var(--background);
@@ -49,174 +54,15 @@ html[data-theme='liquid-glass'] {
background: transparent;
}
- .collapsable {
- border: 1px solid var(--liquid-glass-border);
- border-radius: var(--curve-factor);
- background: var(--item-group-outer-background);
- box-shadow: var(--item-group-shadow);
- }
-
- .collapsable .collapsible-content {
- background: var(--item-group-background);
- }
-
- .item {
- border: 1px solid transparent;
- border-radius: calc(var(--curve-factor) - 0.15rem);
- background: var(--liquid-glass-surface);
- box-shadow: var(--item-shadow);
- transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
-
- &:hover, &:focus {
- border-color: var(--liquid-glass-border);
- background: rgba(47, 83, 128, 0.72);
- box-shadow: var(--item-hover-shadow);
- transform: translateY(-1px);
- }
- }
-
- .nav-outer nav .nav-item,
- .search-wrap form,
- .search-wrap input,
- .theme-dropdown .vs__dropdown-toggle,
- .display-options svg,
- svg.color-button {
- border: 1px solid var(--liquid-glass-border);
- border-radius: var(--curve-factor);
- background: var(--liquid-glass-surface);
- color: var(--foreground);
- }
-
- .nav-outer nav .nav-item:hover,
- .nav-outer nav .nav-item:focus,
- .display-options svg:hover,
- .display-options svg.selected,
- svg.color-button:hover,
- svg.color-button.selected {
- background: var(--liquid-glass-highlight);
- border-color: rgba(225, 241, 255, 0.4);
- }
-
- /* Keep blur to bounded chrome surfaces instead of every card/item. */
- @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- header,
- section.settings-outer,
- .options-panel,
- dialog.dashy-modal,
- .theme-configurator-wrapper,
- .view-switcher {
- -webkit-backdrop-filter: blur(var(--liquid-glass-blur)) saturate(125%);
- backdrop-filter: blur(var(--liquid-glass-blur)) saturate(125%);
- background: var(--liquid-glass-surface-strong);
- border: 1px solid var(--liquid-glass-border);
- box-shadow: 0 18px 42px rgba(1, 8, 20, 0.3);
- }
- }
-
- /* Solid surface fallback for browsers without backdrop-filter support. */
- @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
- header,
- section.settings-outer,
- .options-panel,
- dialog.dashy-modal,
- .theme-configurator-wrapper,
- .view-switcher {
- background: #122947;
- border: 1px solid #496888;
- box-shadow: 0 12px 28px rgba(1, 8, 20, 0.3);
- }
- }
-}
-
-/* Reduce GPU work on touch devices and constrained/reduced-data sessions. */
-@media (max-width: 780px), (hover: none), (prefers-reduced-data: reduce) {
- html[data-theme='liquid-glass'] {
- --liquid-glass-blur: 0px;
-
- body {
- background-attachment: scroll;
- }
-
- header,
- section.settings-outer,
- .options-panel,
- dialog.dashy-modal,
- .theme-configurator-wrapper,
- .view-switcher {
- -webkit-backdrop-filter: none;
- backdrop-filter: none;
- background: var(--liquid-glass-surface-strong);
- }
-
- .item {
- box-shadow: 0 4px 12px rgba(1, 8, 20, 0.2);
- transition: none;
-
- &:hover, &:focus {
- transform: none;
- }
- }
- }
-}
-
-@media (prefers-reduced-motion: reduce) {
- html[data-theme='liquid-glass'] {
- body {
- background-attachment: scroll;
- }
-
- *, *::before, *::after {
- animation-duration: 0.01ms !important;
- animation-iteration-count: 1 !important;
- scroll-behavior: auto !important;
- transition-duration: 0.01ms !important;
- }
-
- .item:hover, .item:focus {
- transform: none;
- }
- }
-}
-
-@media (forced-colors: active) {
- html[data-theme='liquid-glass'] {
- --primary: LinkText;
- --foreground: CanvasText;
- --background: Canvas;
- --background-darker: Canvas;
- --item-group-outer-background: Canvas;
- --item-group-background: Canvas;
- --item-group-heading-text-color: CanvasText;
- --settings-background: Canvas;
- --settings-text-color: CanvasText;
-
- body {
- background: Canvas;
- color: CanvasText;
- }
-
- header,
- section.settings-outer,
- .options-panel,
- dialog.dashy-modal,
- .theme-configurator-wrapper,
- .view-switcher,
- .collapsable,
- .item,
- .nav-outer nav .nav-item {
- -webkit-backdrop-filter: none;
- backdrop-filter: none;
- background: Canvas;
- border: 1px solid ButtonText;
- box-shadow: none;
- color: CanvasText;
- }
-
- .item:hover, .item:focus,
- .nav-outer nav .nav-item:hover,
- .nav-outer nav .nav-item:focus {
- background: Highlight;
- color: HighlightText;
- }
+ header,
+ section.settings-outer,
+ .options-panel,
+ dialog.dashy-modal,
+ .theme-configurator-wrapper,
+ .view-switcher {
+ -webkit-backdrop-filter: blur(14px) saturate(125%);
+ backdrop-filter: blur(14px) saturate(125%);
+ background: var(--settings-background);
+ border: 1px solid var(--nav-link-border-color);
}
}
diff --git a/src/utils/config/ConfigSchema.json b/src/utils/config/ConfigSchema.json
index b6781c22..f2285736 100644
--- a/src/utils/config/ConfigSchema.json
+++ b/src/utils/config/ConfigSchema.json
@@ -353,8 +353,7 @@
"solarized-light",
"brutalist",
"midnight",
- "catppuccin",
- "liquid-glass"
+ "catppuccin"
]
},
"dayTheme": {
diff --git a/tests/unit/liquid-glass-theme.test.js b/tests/unit/liquid-glass-theme.test.js
deleted file mode 100644
index da0600b4..00000000
--- a/tests/unit/liquid-glass-theme.test.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-import { builtInThemes } from '@/utils/config/defaults';
-import { applyTheme } from '@/utils/Theming';
-
-const themeStylesPath = path.resolve(__dirname, '../../src/styles/themes/_liquid-glass.scss');
-const schemaPath = path.resolve(__dirname, '../../src/utils/config/ConfigSchema.json');
-
-describe('Liquid Glass theme registration', () => {
- it('is available to the shared theme picker registration', () => {
- expect(builtInThemes).toContain('liquid-glass');
- });
-
- it('is available as a config schema theme example', () => {
- const schema = JSON.parse(fs.readFileSync(schemaPath, 'utf8'));
- const examples = schema.properties.appConfig.properties.theme.examples;
- expect(examples).toContain('liquid-glass');
- });
-
- it('keeps existing glass themes and applies the new theme through the shared path', () => {
- applyTheme('glass-2');
- expect(document.documentElement.dataset.theme).toBe('glass-2');
-
- applyTheme('liquid-glass');
- expect(document.documentElement.dataset.theme).toBe('liquid-glass');
- });
-});
-
-describe('Liquid Glass accessibility and performance fallbacks', () => {
- const styles = fs.readFileSync(themeStylesPath, 'utf8');
-
- it('uses the token architecture and a bounded backdrop-filter surface list', () => {
- expect(styles).toContain('--primary:');
- expect(styles).toContain('--background:');
- expect(styles).toContain('@supports ((backdrop-filter: blur(1px))');
- expect(styles).toContain('@supports not ((backdrop-filter: blur(1px))');
- });
-
- it('includes reduced motion, forced colors, and constrained-device fallbacks', () => {
- expect(styles).toContain('@media (prefers-reduced-motion: reduce)');
- expect(styles).toContain('@media (forced-colors: active)');
- expect(styles).toContain('@media (max-width: 780px), (hover: none), (prefers-reduced-data: reduce)');
- });
-});