An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/7976
Daniel799cfad0c8b4
diff --git a/app/src/util/assets.ts b/app/src/util/assets.tsindex 38be6b697a..07afccf34d 100644--- a/app/src/util/assets.ts+++ b/app/src/util/assets.ts@@ -388,21 +388,29 @@ export const getThemeMode = () => {export const setBodyHighlight = () => {const name = getWorkspaceName();- if (!name) {- return;- }+ if (!name) { return; }- // 1. 使用 DJB2 算法计算整个字符串的哈希值let hash = 5381;for (let i = 0; i < name.length; i++) {- // hash * 33 + charCodehash = (hash << 5) + hash + name.charCodeAt(i);}- // 2. 取模得到 0-359 的色相值- // 使用绝对值确保结果为正数- const hue = Math.abs(hash) % 360;+ const absHash = Math.abs(hash);+ const probability = absHash % 100;- // 3. 调整 HSL:饱和度设为 75%,亮度设为 35%- document.documentElement.style.setProperty("--b3-body-background-hl", `${hue}, 75%, 35%`);-};+ let hue;+ // 特殊处理:如果是 "SiYuan",强制进入暖色系+ if (name === "SiYuan" || probability < 75) {+ // 【暖色系】: 300° -> 0° -> 60°+ hue = (absHash % 121) - 60;+ if (hue < 0) hue += 360;+ } else {+ // 【冷色系】: 80° -> 280°+ hue = 80 + (absHash % 201);+ }++ document.documentElement.style.setProperty(+ "--b3-body-background-hl",+ `${hue}, 75%, 35%`+ );+};\ No newline at end of file