Function: css--format-hex
css--format-hex is a byte-compiled function defined in css-mode.el.gz.
Signature
(css--format-hex HEX)
Documentation
Format a CSS hex color by shortening it if possible.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/css-mode.el.gz
(defun css--format-hex (hex)
"Format a CSS hex color by shortening it if possible."
(let ((parts (seq-partition (seq-drop hex 1) 2)))
(if (and (>= (length hex) 6)
(seq-every-p (lambda (p) (eq (elt p 0) (elt p 1))) parts))
(apply #'string
(cons ?# (mapcar (lambda (p) (elt p 0)) parts)))
hex)))