frontend: remove the stylix overlay and add hyperhive and Catppuccin light and dark themes
This commit is contained in:
parent
989d1d578c
commit
91e2d26133
1 changed files with 486 additions and 413 deletions
|
|
@ -3,8 +3,10 @@
|
|||
// `useApplyMotionOverride`), but that is after the page has painted, so a light
|
||||
// OS showed a light flash before the dark default took over. This runs from a
|
||||
// blocking script in the head, as the page's policy allows no inline script. The
|
||||
// keys and the fallbacks ("dark" for the theme, "system" for motion) are those of
|
||||
// `shell/Shell.tsx`; `test/theme-boot.test.mjs` keeps them in step.
|
||||
// keys and the fallbacks (hyperhive dark for the theme, "system" for motion) are
|
||||
// those of `shell/Shell.tsx`, and the theme ids and the values from before
|
||||
// themes existed are those of `@hive/shared`'s `settings/themes.ts`;
|
||||
// `test/theme-boot.test.mjs` keeps them in step.
|
||||
(function () {
|
||||
function read(key, fallback) {
|
||||
try {
|
||||
|
|
@ -15,8 +17,17 @@
|
|||
}
|
||||
}
|
||||
var root = document.documentElement;
|
||||
var theme = read("swarm-ui:theme-override", "dark");
|
||||
if (theme === "light" || theme === "dark") root.dataset.theme = theme;
|
||||
var themes = [
|
||||
"hyperhive-light",
|
||||
"hyperhive-dark",
|
||||
"catppuccin-latte-mauve",
|
||||
"catppuccin-mocha-mauve",
|
||||
"catppuccin-mocha-mara",
|
||||
];
|
||||
var theme = read("swarm-ui:theme-override", "hyperhive-dark");
|
||||
if (theme === "light") theme = "hyperhive-light";
|
||||
if (theme === "dark") theme = "hyperhive-dark";
|
||||
if (themes.indexOf(theme) >= 0) root.dataset.theme = theme;
|
||||
var motion = read("swarm-ui:motion-override", "system");
|
||||
if (motion === "reduce" || motion === "allow") root.dataset.motion = motion;
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue