From 710e52c67f2163915beb259a901388c27c72ebd7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 7 Jan 2026 03:51:28 +0000 Subject: [PATCH] Fix tp-parse-color to handle unknown background-mode When (frame-parameter nil 'background-mode) returns nil (e.g., in batch mode or certain configurations), both tp-theme-light-p and tp-theme-dark-p return nil, causing color parsing to fail for cons cell ("light" . "dark") and plist (:light "l" :dark "d") formats. Added default fallback to light color when background-mode is unknown. This is the root cause of tp-palette settings not taking effect. Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com> --- tp.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tp.el b/tp.el index e696a97..f7239e8 100644 --- a/tp.el +++ b/tp.el @@ -4783,13 +4783,17 @@ e.g.3 (tp-parse-color '(:light \"red\" :dark \"green\"))" (stringp (cdr color))) (cond ((tp-theme-light-p) (car color)) - ((tp-theme-dark-p) (cdr color)))) + ((tp-theme-dark-p) (cdr color)) + ;; Default to light color when background-mode is unknown + (t (car color)))) ((and (plistp color) (or (plist-member color :light) (plist-member color :dark))) (cond ((tp-theme-light-p) (plist-get color :light)) - ((tp-theme-dark-p) (plist-get color :dark)))) + ((tp-theme-dark-p) (plist-get color :dark)) + ;; Default to light color when background-mode is unknown + (t (plist-get color :light)))) ((null color) nil) (t (error "Invalid format of color %S" color))))