3 (defun luminance (r g b)
4 (+ (* r 0.299) (* g 0.587) (* b 0.114)))
6 (defun std-pick-color-html-fn ()
7 (flet ((color-td (r g b)
8 (let ((color (format nil "#~2,'0x~2,'0x~2,'0x" r g b)))
9 (html ((:td :bgcolor color
10 :fformat (:onclick "f42('~a');"
11 color))" ")))))
16 (push (list (* r 51) (* g 51) (* b 51)(luminance r g b))
18 (setf colors (sort colors #'> :key 'fourth))
21 (:title "Choose a color")
22 ((:link :rel "stylesheet" :type "text/css" :href "/pcol.css")))
25 (:h1 "Choose a color")
27 f42(d){window.opener.change_color(d);window.close();};")
28 ((:table :class "pcolt" :align "center")
30 for row = (loop repeat 12 collect (pop colors))
31 for bl = (round (* 255 (- 1 (/ x 17))))
42 (loop for (r g b l) in row
43 do (color-td r g b))))))
45 ((:div :align "center")
46 ((:a :class "call" :href "javascript:window.close();")