mirror of
https://github.com/hasso5703/alzeo.git
synced 2026-12-06 04:44:19 +01:00
Hasan, 2026-11-30: texts that change make the elements change size, "ça bouge et ça fait cheap". Measured on 42 snapshots of a box's life: what serves changed its width by 161 px, a job moved the pool's gauge by 276, a banner pushed every card by 122 to 418, and Chrome's own layout-shift score was 0.57 to 3.0 a view. Every value has a place of its own now, what comes and goes has a slot, the notices are one line under the head with the whole of each a press away, and what serves takes the room the head leaves. Now: the pool and a short rack on the left, what the lane does and where a client reaches it beside them. Lanes: short cards (three facts at one pitch, one action, More for the rest), by kind and by installed. A quieter violet night, flat panels, one line of light at the foot of the head; a reading that is fine wears no colour. dashboard/tests/stability-check.mjs, in CI: 74 snapshots, four widths, three themes, no box moves by more than half a pixel (65 of 65; 1 of 65 on the page before). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
"use strict";
|
|
/* The cockpit's themes, kept in this browser. The stylesheet holds the palettes:
|
|
data-theme on <html> is the only switch. The default is indigo, so a missing
|
|
or unreadable preference never changes the page. */
|
|
const COCKPIT_THEME_KEY = 'cockpit.theme';
|
|
const COCKPIT_THEME_COLOR = Object.freeze({indigo: '#130d28', graphite: '#09090b', paper: '#f6f7fb'});
|
|
const cockpitTheme = name => Object.prototype.hasOwnProperty.call(COCKPIT_THEME_COLOR, name);
|
|
|
|
function themeName(){
|
|
const name = document.documentElement.dataset.theme;
|
|
return cockpitTheme(name) ? name : 'indigo';
|
|
}
|
|
|
|
function applyTheme(name, persist){
|
|
name = cockpitTheme(name) ? name : 'indigo';
|
|
document.documentElement.dataset.theme = name;
|
|
const meta = document.querySelector('meta[name="theme-color"]');
|
|
if (meta) meta.setAttribute('content', COCKPIT_THEME_COLOR[name]);
|
|
if (persist !== false){
|
|
try { localStorage.setItem(COCKPIT_THEME_KEY, name); } catch { /* private mode keeps it for this page */ }
|
|
}
|
|
if (window.cockpitBackdrop) window.cockpitBackdrop.sync();
|
|
return name;
|
|
}
|
|
|
|
(function(){
|
|
let saved = null;
|
|
try { saved = localStorage.getItem(COCKPIT_THEME_KEY); } catch { /* private mode: the default */ }
|
|
applyTheme(saved, false);
|
|
})();
|