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