Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve combined setting item text color https://github.com/siyuan-note/siyuan/issues/18882

Daniel9f4050873b03
diff --git a/app/src/config/render/render.test.ts b/app/src/config/render/render.test.ts
new file mode 100644
index 0000000000..09b9f1790d
--- /dev/null
+++ b/app/src/config/render/render.test.ts
@@ -0,0 +1,30 @@
+import * as assert from "node:assert/strict";
+import {describe, it} from "node:test";
+import {genStackHtml} from "./render";
+
+describe("genStackHtml", () => {
+ it("renders descriptions with controls using the primary text color", () => {
+ const html = genStackHtml([{
+ left: {kind: "desc", text: "Setting name"},
+ right: {kind: "button", id: "setting", label: "Configure", icon: "iconSettings"},
+ }]);
+
+ assert.match(html, /class="fn__flex-center fn__flex-1 config-item__main">Setting name<\/div>/);
+ assert.doesNotMatch(html, /ft__on-surface/);
+ });
+
+ it("keeps standalone descriptions styled as secondary text", () => {
+ const html = genStackHtml([{left: {kind: "desc", text: "Setting description"}}]);
+
+ assert.match(html, /class="b3-label__text">Setting description<\/div>/);
+ });
+
+ it("keeps titles with controls styled as configuration names", () => {
+ const html = genStackHtml([{
+ left: {kind: "title", text: "Setting title"},
+ right: {kind: "button", id: "setting", label: "Configure", icon: "iconSettings"},
+ }]);
+
+ assert.match(html, /class="fn__flex-center fn__flex-1 config-item__main config-name">Setting title<\/div>/);
+ });
+});
diff --git a/app/src/config/render/render.ts b/app/src/config/render/render.ts
index f6bc625e4b..b0a3c4cc2b 100644
--- a/app/src/config/render/render.ts
+++ b/app/src/config/render/render.ts
@@ -158,7 +158,7 @@ const genStackLeft = (left: StackLeft, hasRight: boolean): string => {
if (!hasRight) {
return left.kind === "title" ? genConfigItemName(left.text) : `<div class="b3-label__text">${left.text}</div>`;
}
- return `<div class="fn__flex-center fn__flex-1 config-item__main${left.kind === "desc" ? " ft__on-surface" : " config-name"}">${left.text}</div>`;
+ return `<div class="fn__flex-center fn__flex-1 config-item__main${left.kind === "title" ? " config-name" : ""}">${left.text}</div>`;
};
/** 纵向堆叠行 */