fix to rgb-to-hex

This commit is contained in:
David Botton 2024-03-27 21:13:07 -04:00
parent bc3f8dd58c
commit ea4c4a07a5

View file

@ -153,7 +153,7 @@ package."
(defun rgb-to-hex (rgb)
"Return hex #rrggbb from rgb(red,green,blue)"
(multiple-value-bind (m l)
(ppcre:scan-to-strings "rgba?\\s?\\((\\d+),\\s?(\\d+),\\s?(\\d+),?\\s?(\\d*)\\)" rgb)
(ppcre:scan-to-strings "rgba?\\s?\\((\\d+),\\s?(\\d+),\\s?(\\d+),?\\s?(\\d|\.*)\\)" rgb)
(declare (ignore m))
(format nil "#~2,'0x~2,'0x~2,'0x"
(parse-integer (aref l 0))