Function: indent-bars--colors-from-regexp

indent-bars--colors-from-regexp is a natively compiled function defined in indent-bars.el.

Signature

(indent-bars--colors-from-regexp REGEXP &optional FACE-BG)

Documentation

Return a list of colors (strings) for faces matching REGEXP.

The first capture group in REGEXP will be interpreted as a number and used to sort the list numerically. A list of the foreground color of the matching, sorted faces will be returned, unless FACE-BG is non-nil, in which case the background color is returned.

Source Code

;; Defined in /nix/store/zkcdcnmcj3605fj09x584bf58d85brax-emacs-packages-deps/share/emacs/site-lisp/elpa/indent-bars-1.0.1/indent-bars.el
(defun indent-bars--colors-from-regexp (regexp &optional face-bg)
  "Return a list of colors (strings) for faces matching REGEXP.
The first capture group in REGEXP will be interpreted as a number
and used to sort the list numerically.  A list of the foreground
color of the matching, sorted faces will be returned, unless
FACE-BG is non-nil, in which case the background color is
returned."
  (mapcar (lambda (x)
	    (funcall (if face-bg #'face-background #'face-foreground)
		     (cdr x) nil 'default))
          (seq-sort-by #'car
	   (lambda (a b) (cond
			  ((not (numberp b)) t)
			  ((not (numberp a)) nil)
			  (t (< a b))))
	   (mapcan
	    (lambda (x)
	      (let ((n (symbol-name x)))
		(when (and (string-match regexp n) (match-string 1 n))
                  (list (cons (string-to-number (match-string 1 n)) x)))))
	    (face-list)))))