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>
This commit is contained in:
parent
6c111dfd2b
commit
710e52c67f
8
tp.el
8
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))))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user