shr-color: only return hexadecimal part of colors
authorJulien Danjou <julien@danjou.info>
Wed, 24 Nov 2010 08:49:56 +0000 (09:49 +0100)
committerJulien Danjou <julien@danjou.info>
Wed, 24 Nov 2010 08:51:04 +0000 (09:51 +0100)
Signed-off-by: Julien Danjou <julien@danjou.info>
lisp/ChangeLog
lisp/shr-color.el
lisp/shr.el

index a74389e..a00b9bb 100644 (file)
@@ -1,5 +1,10 @@
 2010-11-24  Julien Danjou  <julien@danjou.info>
 
+       * 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  <yamaoka@jpl.org>
index 1e96567..78fd039 100644 (file)
@@ -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*)"
index 3d3b199..fc1286e 100644 (file)
@@ -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)))))))