Files
deerflow-code/frontend-web/src/core/embed/theme-mode.mjs
T
Rocky Kwok 75aad4eef6 fix(frontend): preserve iframe theme across login
The iframe login used a fixed queryless redirect and called setTheme, which both dropped the iframe theme and persisted it into the normal site's shared theme storage.
2026-07-27 09:54:22 +08:00

20 lines
460 B
JavaScript

/**
* @typedef {"light" | "dark"} EmbedThemeMode
*/
/**
* Map external theme names to the two themes supported by iframe surfaces.
*
* @param {string | null | undefined} rawTheme
* @returns {EmbedThemeMode}
*/
export function resolveEmbedThemeMode(rawTheme) {
const theme = (rawTheme ?? "").trim().toLowerCase();
return theme === "dark" ||
theme === "dark-blue" ||
theme === "深色" ||
theme === "深蓝"
? "dark"
: "light";
}