Function: css--color-to-4-dpc
css--color-to-4-dpc is a byte-compiled function defined in
css-mode.el.gz.
Signature
(css--color-to-4-dpc HEX)
Documentation
Convert the CSS color HEX to four digits per component.
CSS colors use one or two digits per component for RGB hex values. Convert the given color to four digits per component.
Note that this function handles CSS colors specifically, and should not be mixed with those in color.el.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/css-mode.el.gz
(defun css--color-to-4-dpc (hex)
"Convert the CSS color HEX to four digits per component.
CSS colors use one or two digits per component for RGB hex
values. Convert the given color to four digits per component.
Note that this function handles CSS colors specifically, and
should not be mixed with those in color.el."
(let ((six-digits (= (length hex) 7)))
(apply
#'concat
`("#"
,@(seq-mapcat
(apply-partially #'make-list (if six-digits 2 4))
(seq-partition (seq-drop hex 1) (if six-digits 2 1)))))))