From cfc9618e87579d7da423292c8bc90bab7baf4a3c Mon Sep 17 00:00:00 2001
From: xiaoshi <115949669+xiaoshi930@users.noreply.github.com>
Date: Sat, 13 Dec 2025 22:48:34 +0800
Subject: [PATCH] Update xiaoshi-device-todo-button.js
---
xiaoshi-device-todo-button.js | 52 +++++++++++++++++++++++++++--------
1 file changed, 40 insertions(+), 12 deletions(-)
diff --git a/xiaoshi-device-todo-button.js b/xiaoshi-device-todo-button.js
index d37c063..989927a 100644
--- a/xiaoshi-device-todo-button.js
+++ b/xiaoshi-device-todo-button.js
@@ -213,7 +213,6 @@ class XiaoshiTodoButtonEditor extends LitElement {
-
-
+
+
+
+
+ (平板端特性)白色图标文字(勾选后锁定显示白色)
+
+
+
- 隐藏图标(勾选后隐藏图标)
+ ( 平板端特性)隐藏图标(勾选后隐藏图标)
-
+
- 隐藏冒号(勾选后不显示冒号,改为空格)
+ (平板端特性)隐藏冒号(勾选后不显示冒号,改为空格)
-
+
- 隐藏0值(勾选后数量为0时不显示数量)
+ (平板端特性)隐藏0值(勾选后数量为0时不显示数量)
@@ -1618,6 +1631,7 @@ class XiaoshiTodoButton extends LitElement {
const hideColon = this.config.hide_colon === true;
const hideZero = this.config.hide_zero === true;
const autoHide = this.config.auto_hide === true;
+ const lockWhiteFg = this.config.lock_white_fg === true;
const buttonText = this.config.button_text || '待办';
const buttonIcon = this.config.button_icon || 'mdi:clipboard-list';
@@ -1644,6 +1658,10 @@ class XiaoshiTodoButton extends LitElement {
`;
} else {
// 普通模式
+ // 应用锁定白色功能
+ const iconColor = lockWhiteFg ? 'rgb(255, 255, 255)' : fgColor;
+ const textColor = lockWhiteFg ? 'rgb(255, 255, 255)' : fgColor;
+
// 构建显示文本
let displayText = buttonText;
@@ -1663,8 +1681,8 @@ class XiaoshiTodoButton extends LitElement {
}
buttonHtml = html`
-
- ${!hideIcon ? html`
` : ''}
+
+ ${!hideIcon ? html`` : ''}
${displayText}
`;
@@ -1682,7 +1700,17 @@ class XiaoshiTodoButton extends LitElement {
`;
} else {
// 普通模式:显示文本和数量
- const textColor = totalIncompleteCount === 0 ? fgColor : 'rgb(255, 0, 0)';
+ // 应用锁定白色功能,但预警颜色(红色)不受影响
+ let textColor, iconColor;
+ if (totalIncompleteCount === 0) {
+ // 非预警状态:根据锁定白色设置决定颜色
+ textColor = lockWhiteFg ? 'rgb(255, 255, 255)' : fgColor;
+ iconColor = lockWhiteFg ? 'rgb(255, 255, 255)' : fgColor;
+ } else {
+ // 预警状态:始终使用红色,不受锁定白色影响
+ textColor = 'rgb(255, 0, 0)';
+ iconColor = lockWhiteFg ? 'rgb(255, 255, 255)' : fgColor;
+ }
// 构建显示文本
let displayText = buttonText;
@@ -1704,7 +1732,7 @@ class XiaoshiTodoButton extends LitElement {
buttonHtml = html`
- ${!hideIcon ? html`` : ''}
+ ${!hideIcon ? html`` : ''}
${displayText}
`;