* doc/misc/eww.texi (Basics): Mention "C".
* lisp/net/eww.el (eww-toggle-colors): New command and keystroke.
* lisp/net/shr.el (shr-use-colors): New variable.
(shr-colorize-region): Use it.
The @kbd{F} command (@code{eww-toggle-fonts}) toggles whether to use
variable-pitch fonts or not. This sets the @code{shr-use-fonts} variable.
+@findex eww-toggle-colors
+@findex shr-use-colors
+@kindex F
+ The @kbd{C} command (@code{eww-toggle-colors}) toggles whether to use
+HTML-specified colors or not. This sets the @code{shr-use-colors} variable.
+
@findex eww-download
@vindex eww-download-directory
@kindex d
whether to use variable-pitch fonts or not. The user can also
customize the `shr-use-fonts' variable.
++++
+*** A new command `C' (`eww-toggle-colors) can be used to toggle
+whether to use the HTML-specified colors or not. The user can also
+customize the `shr-use-colors variable.
+
+++
*** A new command `R' (`eww-readable') will try do identify the main
textual parts of a web page and display only that, leaving menus and
(define-key map "E" 'eww-set-character-encoding)
(define-key map "S" 'eww-list-buffers)
(define-key map "F" 'eww-toggle-fonts)
+ (define-key map [(meta C)] 'eww-toggle-fonts)
(define-key map "b" 'eww-add-bookmark)
(define-key map "B" 'eww-list-bookmarks)
["Add bookmark" eww-add-bookmark t]
["List bookmarks" eww-list-bookmarks t]
["List cookies" url-cookie-list t]
+ ["Toggle fonts" eww-toggle-fonts t]
+ ["Toggle colors" eww-toggle-colors t]
["Character Encoding" eww-set-character-encoding]))
map))
"off"))
(eww-reload))
+(defun eww-toggle-colors ()
+ "Toggle whether to use HTML-specified colors or not."
+ (interactive)
+ (message "Colors are now %s"
+ (if (setq shr-use-colors (not shr-use-colors))
+ "on"
+ "off"))
+ (eww-reload))
+
;;; Bookmarks code
(defvar eww-bookmarks nil)
:group 'shr
:type 'boolean)
+(defcustom shr-use-colors t
+ "If non-nil, respect color specifications in the HTML."
+ :version "25.2"
+ :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."
(shr-color-visible bg fg)))))))
(defun shr-colorize-region (start end fg &optional bg)
- (when (and (or fg bg) (>= (display-color-cells) 88))
+ (when (and shr-use-colors
+ (or fg bg)
+ (>= (display-color-cells) 88))
(let ((new-colors (shr-color-check fg bg)))
(when new-colors
(when fg