0

I'd like to change the foreground color of non-current ivy items. The only way that I've found to do that so far is to define my own ivy-format-function like this:

(defun aj/ivy-format-function-line (cands)
"Transform CANDS into a string for minibuffer."
  (ivy--format-function-generic
   (lambda (str)
     (ivy--add-face (concat str "\n") 'ivy-current-match))
   (lambda (str)
     (ivy--add-face (concat str "\n") 'ivy-not-current))
   cands
   ""))

Unfortunately, this prevents ivy-minibuffer-match-face-1's foreground color from taking effect (it should be white and bold) because ivy-not-current takes precedence. Is there a better way to do this?

ivy example

0

This appears to work as I want, though if there's a better/more official way I'm all ears.

(defun aj/ivy-format-function-line (cands)
  "Transform CANDS into a string for minibuffer."
  (ivy--format-function-generic
   (lambda (str)
     (ivy--add-face (concat str "\n") 'ivy-current-match))
   (lambda (str)
     (let ((s (concat str "\n")))
       (font-lock-append-text-property 0 (length s) 'face 'ivy-not-current s)
       s))
   cands
   ""))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.