From f047b2d283bebed2d7c5e576be66205cace0f13c Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Fri, 9 Dec 2022 20:44:08 +0600 Subject: [PATCH] Fix terminal color reporting in text terminals * eat.el (eat--t-report-foreground-color): Fix foreground color reporting in text terminals. * eat.el (eat--t-report-background-color): Fix background color reporting in text terminals. --- eat.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/eat.el b/eat.el index 52992f8..1a4d1e0 100644 --- a/eat.el +++ b/eat.el @@ -2377,7 +2377,10 @@ output." "Report the current default foreground color to the client." (funcall (eat--t-term-input-fn eat--t-term) eat--t-term - (let ((rgb (color-values (face-foreground 'default)))) + (let ((rgb (or (color-values (face-foreground 'default)) + ;; On terminals like TTYs the above returns nil. + ;; Terminals usually have a white foreground, so... + '(255 255 255)))) (format "\e]10;%04x/%04x/%04x\e\\" (pop rgb) (pop rgb) (pop rgb))))) @@ -2385,7 +2388,10 @@ output." "Report the current default background color to the client." (funcall (eat--t-term-input-fn eat--t-term) eat--t-term - (let ((rgb (color-values (face-background 'default)))) + (let ((rgb (or (color-values (face-background 'default)) + ;; On terminals like TTYs the above returns nil. + ;; Terminals usually have a black background, so... + '(0 0 0)))) (format "\e]11;%04x/%04x/%04x\e\\" (pop rgb) (pop rgb) (pop rgb)))))