From: Julien Danjou Date: Wed, 24 Nov 2010 08:49:56 +0000 (+0100) Subject: shr-color: only return hexadecimal part of colors X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=6140035ce0d823a83efc591efd508f994285783d;hp=16dcabcb7241cdc9df5dbdec5dbffb1f49773168 shr-color: only return hexadecimal part of colors Signed-off-by: Julien Danjou --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a74389e35..a00b9bbd4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2010-11-24 Julien Danjou + * shr.el (shr-insert-color-overlay): Remove specific rgb() check. + + * shr-color.el (shr-color->hexadecimal): Only return the hexadecimal + matched part. + * color-lab.el: Fix all expt calls to use float type. 2010-11-24 Katsumi Yamaoka diff --git a/lisp/shr-color.el b/lisp/shr-color.el index 1e9656738..78fd03952 100644 --- a/lisp/shr-color.el +++ b/lisp/shr-color.el @@ -231,10 +231,10 @@ Like rgb() or hsl()." (when color (cond ;; Hexadecimal color: #abc or #aabbcc - ((string-match-p - "#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?" + ((string-match + "\\(#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?\\)" color) - color) + (match-string 1 color)) ;; rgb() or rgba() colors ((or (string-match "rgb(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*)" diff --git a/lisp/shr.el b/lisp/shr.el index 3d3b199cd..fc1286e7a 100644 --- a/lisp/shr.el +++ b/lisp/shr.el @@ -502,9 +502,6 @@ START, and END." (defun shr-insert-color-overlay (color start end) (when color - (when (and (not (string-match "\\`rgb([^\)]+)\\'" color)) - (string-match " " color)) - (setq color (car (split-string color)))) (let ((overlay (make-overlay start end))) (overlay-put overlay 'face (cons 'foreground-color (cadr (shr-color-check color)))))))