Function: pdf-util-hexcolor

pdf-util-hexcolor is a natively compiled function defined in pdf-util.el.

Signature

(pdf-util-hexcolor COLOR)

Documentation

Return COLOR in hex-format.

Signal an error, if color is invalid.

Source Code

;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-util.el
(defun pdf-util-hexcolor (color)
  "Return COLOR in hex-format.

Signal an error, if color is invalid."
  (if (string-match "\\`#[[:xdigit:]]\\{6\\}\\'" color)
      color
    (let ((values (color-values color)))
      (unless values
        (signal 'wrong-type-argument (list 'color-defined-p color)))
      (apply #'format "#%02x%02x%02x"
             (mapcar (lambda (c) (ash c -8))
                     values)))))