@gjsify/adwaita-web 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -151,6 +151,40 @@ surface + light/dark `color-scheme` by adding the `adw-root` class to `<body>`
151
151
  `--window-fg-color` + `color-scheme: light dark` to the page and changes nothing
152
152
  about the individual components.
153
153
 
154
+ ## Following the desktop's accent
155
+
156
+ A page follows the desktop's accent and colour scheme from these sources, highest
157
+ first ([ADR 0078](../../../docs/adr/0078-the-desktop-appearance-reaches-a-web-page-through-a-handoff.md)):
158
+
159
+ 1. **your own choice**: `applyAdwaitaAccent('green')`. Nothing below overrides it;
160
+ `clearAdwaitaAccent()` hands the page back.
161
+ 2. **a server handoff**: `<meta name="adw-accent" content="purple">` and
162
+ `<meta name="adw-color-scheme" content="dark">` in `<head>`, read on import and
163
+ whenever they change, or `applyDesktopAppearance(json)` for live updates. A gjsify
164
+ server writes the tags with `renderAppearanceMeta` from
165
+ `@gjsify/adwaita-app/appearance`.
166
+ 3. **the CSS system colour `AccentColor`**, once you call `applySystemAccent()` or
167
+ the tag says `content="system"` (#1821).
168
+ 4. **Adwaita blue**, the stylesheet's own value.
169
+
170
+ ```ts
171
+ import { applyDesktopAppearance, applySystemAccent } from '@gjsify/adwaita-web';
172
+
173
+ applySystemAccent(); // follow AccentColor where the engine resolves it; returns the accent or null
174
+ new EventSource('/appearance').onmessage = (event) => applyDesktopAppearance(JSON.parse(event.data));
175
+ ```
176
+
177
+ Every source is snapped to one of the nine accents with `nearestAccent`, as libadwaita
178
+ does, so the page matches a native Adwaita window on the same desktop.
179
+ `adwaitaAccentSource()` tells you which source won. Only `<html>` follows.
180
+
181
+ `AccentColor` support differs between engines and has not been verified everywhere.
182
+ Chrome announced shipping it only in 2026. On a GNOME desktop set to purple,
183
+ Playwright's headless Firefox 151 resolved it to `rgb(0, 96, 223)` and headless
184
+ Chromium 149 to `rgb(0, 117, 255)`: both blue, neither the desktop's accent. A page
185
+ cannot tell such a default from a real accent, which is why the server handoff ranks
186
+ above it.
187
+
154
188
  ## Icons, and the ones the stylesheet does not ship
155
189
 
156
190
  A `<gtk-image icon-name="go-next">` is a CSS mask: the box takes its colour from
@@ -312,7 +312,7 @@
312
312
  --spacing-m: 12px;
313
313
  --spacing-l: 18px;
314
314
  --spacing-xl: 24px;
315
- --font-family: 'Adwaita Sans', 'Cantarell', 'Inter', 'Segoe UI', sans-serif;
315
+ --font-family: 'Adwaita Sans', 'Cantarell', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
316
316
  --font-size-base: 11pt;
317
317
  --font-size-small: 9pt;
318
318
  --font-size-heading: 12pt;
@@ -322,7 +322,7 @@
322
322
  --disabled-opacity: 0.5;
323
323
  --document-font-family: var(--font-family);
324
324
  --document-font-size: var(--font-size-base);
325
- --monospace-font-family: 'Adwaita Mono', ui-monospace, 'SF Mono', 'Menlo', monospace;
325
+ --monospace-font-family: 'Adwaita Mono', ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;
326
326
  --monospace-font-size: var(--font-size-base);
327
327
  }
328
328
 
@@ -488,7 +488,7 @@
488
488
  --spacing-m: 12px;
489
489
  --spacing-l: 18px;
490
490
  --spacing-xl: 24px;
491
- --font-family: 'Adwaita Sans', 'Cantarell', 'Inter', 'Segoe UI', sans-serif;
491
+ --font-family: 'Adwaita Sans', 'Cantarell', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
492
492
  --font-size-base: 11pt;
493
493
  --font-size-small: 9pt;
494
494
  --font-size-heading: 12pt;
@@ -498,7 +498,7 @@
498
498
  --disabled-opacity: 0.5;
499
499
  --document-font-family: var(--font-family);
500
500
  --document-font-size: var(--font-size-base);
501
- --monospace-font-family: 'Adwaita Mono', ui-monospace, 'SF Mono', 'Menlo', monospace;
501
+ --monospace-font-family: 'Adwaita Mono', ui-monospace, 'SF Mono', 'Menlo', 'Consolas', monospace;
502
502
  --monospace-font-size: var(--font-size-base);
503
503
  }
504
504