Function: shr-color-relative-to-absolute

shr-color-relative-to-absolute is a byte-compiled function defined in shr-color.el.gz.

Signature

(shr-color-relative-to-absolute NUMBER)

Documentation

Convert a relative NUMBER to absolute.

If NUMBER is absolute, return NUMBER. This will convert "80 %" to 204, "100 %" to 255 but "123" to "123".

Source Code

;; Defined in /usr/src/emacs/lisp/net/shr-color.el.gz
(defun shr-color-relative-to-absolute (number)
  "Convert a relative NUMBER to absolute.
If NUMBER is absolute, return NUMBER.
This will convert \"80 %\" to 204, \"100 %\" to 255 but \"123\" to \"123\"."
  (let ((string-length (- (length number) 1)))
    ;; Is this a number with %?
    (if (eq (elt number string-length) ?%)
        (/ (* (string-to-number (substring number 0 string-length)) 255) 100)
      (string-to-number number))))