comparison lisp/gnus/shr-color.el @ 111701:3fbe2d0ad0f8

color-lab.el: Fix all expt calls to use float type. shr-color.el: only return hexadecimal part of colors. shr.el: Protect against non-existant colour names.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Wed, 24 Nov 2010 11:32:22 +0000
parents c63f96430f63
children cad125981c0f
comparison
equal deleted inserted replaced
111700:3242c8febbd0 111701:3fbe2d0ad0f8
229 "Convert any color format to hexadecimal representation. 229 "Convert any color format to hexadecimal representation.
230 Like rgb() or hsl()." 230 Like rgb() or hsl()."
231 (when color 231 (when color
232 (cond 232 (cond
233 ;; Hexadecimal color: #abc or #aabbcc 233 ;; Hexadecimal color: #abc or #aabbcc
234 ((string-match-p 234 ((string-match
235 "#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?" 235 "\\(#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?\\)"
236 color) 236 color)
237 color) 237 (match-string 1 color))
238 ;; rgb() or rgba() colors 238 ;; rgb() or rgba() colors
239 ((or (string-match 239 ((or (string-match
240 "rgb(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*)" 240 "rgb(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*)"
241 color) 241 color)
242 (string-match 242 (string-match