Emacs comes with a lot of color conversion functions, but it doesn't have a function that handles one of the most common color formats -- #000000. Here's something I wrote a while back to fix that.
(defun color-hex-to-rgb (color)
"Transform a hex encoded COLOR to individual RGB components."
(let* ((_ (string-match (rx "#"
(group (= 2 hex-digit))
(group (= 2 hex-digit))
(group (= 2 hex-digit)))
color))
(r (cl-parse-integer (match-string 1 color) :radix 16))
(g (cl-parse-integer (match-string 2 color) :radix 16))
(b (cl-parse-integer (match-string 3 color) :radix 16)))
(mapcar (lambda (n) (/ n 255.0)) `(,r ,g ,b))))
I want to be able to handle #000 also, but I didn't need it at the time, so I didn't bother.