Skip to content

Commit a144ae3

Browse files
authored
🐛 修复 ScriptEditor 脚本列表亮色显示有问题 (#1288)
* 🐛 修复 ScriptEditor 脚本列表硬编码暗色背景 #1258 中引入了硬编码的暗色 hex 值(#414958/#474747/#333333)和 RGB 文字颜色, 导致脚本列表在亮色模式下也显示为暗色背景。 改用 Arco Design CSS 变量(--color-fill-2, --color-text-2 等),使脚本列表 在亮色/暗色模式下都能正确显示。 * 🐛 使用自定义 CSS 变量替代 Arco 变量,修复亮色模式脚本列表背景色
1 parent 2e875bc commit a144ae3

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

src/pages/options/routes/script/ScriptEditor.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -914,10 +914,7 @@ function ScriptEditor() {
914914
)}
915915
{filteredScriptList.map((script) => {
916916
const editor = editorFindItem(script.uuid);
917-
const colorRGB = !editor ? "173,173,173" : editor.isChanged ? "230,155,31" : "199,199,199";
918917
const alpha = script.status === 2 ? 0.8 : 1.0;
919-
const colorRGBA = `rgba(${colorRGB},${alpha})`;
920-
const delBtnRGBA = `rgba(173,173,173,${alpha})`;
921918
return (
922919
<div key={`s_${script.uuid}`} className="tw-relative tw-group">
923920
<Button
@@ -927,8 +924,18 @@ function ScriptEditor() {
927924
overflow: "hidden",
928925
textOverflow: "ellipsis",
929926
whiteSpace: "nowrap",
930-
color: `${colorRGBA}`,
931-
backgroundColor: selectedScript === script.uuid ? "#414958" : editor ? "#474747" : "#333333",
927+
opacity: alpha,
928+
color: !editor
929+
? "var(--color-text-3)"
930+
: editor.isChanged
931+
? "rgb(var(--warning-6))"
932+
: "var(--color-text-2)",
933+
backgroundColor:
934+
selectedScript === script.uuid
935+
? "var(--editor-bg-selected)"
936+
: editor
937+
? "var(--editor-bg-open)"
938+
: "var(--editor-bg-default)",
932939
paddingRight: "32px", // 为删除按钮留出空间
933940
}}
934941
onClick={() => {
@@ -950,7 +957,7 @@ function ScriptEditor() {
950957
minWidth: "20px",
951958
border: "none",
952959
background: "transparent",
953-
color: `${delBtnRGBA}`,
960+
color: "var(--color-text-3)",
954961
boxShadow: "none",
955962
}}
956963
onClick={(e) => {

src/pages/options/routes/script/index.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55
white-space: nowrap;
66
}
77

8+
/* ScriptEditor 脚本列表颜色变量 */
9+
body {
10+
--editor-bg-selected: #D4D7DE;
11+
--editor-bg-open: #EBEBEB;
12+
--editor-bg-default: #F5F5F5;
13+
}
14+
15+
body[arco-theme='dark'] {
16+
--editor-bg-selected: #414958;
17+
--editor-bg-open: #474747;
18+
--editor-bg-default: #333333;
19+
}
20+
821
.script-code-editor {
922
margin: 0;
1023
padding: 0;

0 commit comments

Comments
 (0)