bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43031: shr and eww disable background colors


From: Bad Blue Bull
Subject: bug#43031: shr and eww disable background colors
Date: Tue, 25 Aug 2020 02:02:18 +0300

I'd like to be able to disable rendering of background colors in EWW since it usually looks nasty.  eww-toggle-colors toggles rendering of both background and foreground colors, I think it's often nice to use foreground colors of the page and ignore background colors.
 
New interactive function eww-toggle-bg-colors is for this purpose.
 
shr.el diff:
--- #<buffer shr.el.gz>
+++ #<buffer shr.el.new>
@@ -77,6 +77,12 @@
:version "26.1"
:type 'boolean)
 
+(defcustom shr-use-bg-colors t
+ "If non-nil, respect background color specifications in the HTML."
+ :group 'shr
+ :type 'boolean)
+
+
(defcustom shr-table-horizontal-line nil
"Character used to draw horizontal table lines.
If nil, don't draw horizontal table lines."
@@ -1307,6 +1313,7 @@
(shr-color-visible bg fg)))))))
 
(defun shr-colorize-region (start end fg &optional bg)
+ (setq bg (and shr-use-bg-colors bg))
(when (and shr-use-colors
(or fg bg)
(>= (display-color-cells) 88))
 
 

eww.el diff:
--- #<buffer eww.el.gz>
+++ #<buffer eww.el.new>
@@ -855,6 +855,7 @@
["List cookies" url-cookie-list t]
["Toggle fonts" eww-toggle-fonts t]
["Toggle colors" eww-toggle-colors t]
+ ["Toggle background colors" eww-toggle-bg-colors t]
["Character Encoding" eww-set-character-encoding]
["Toggle Paragraph Direction" eww-toggle-paragraph-direction]))
map))
@@ -1699,6 +1700,15 @@
(message "Proportional fonts are now %s"
(if shr-use-fonts "on" "off")))
 
+(defun eww-toggle-bg-colors ()
+ "Toggle whether to use HTML-specified background colors or not."
+ (interactive)
+ (message "Colors are now %s"
+ (if (setq shr-use-bg-colors (not shr-use-bg-colors))
+ "on"
+ "off"))
+ (eww-reload))
+
(defun eww-toggle-colors ()
"Toggle whether to use HTML-specified colors or not."
(interactive)
 
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]