Allow to specify :face for each head

* hydra.el (hydra-fontify-head-default): Update - :face will override
  any previously calculated face (red/blue/pink...).

Example:

(defface hydra-face-orange
    '((t (:foreground "orange" :bold t)))
  "Orange face. For fun.")

(defhydra hydra-projectile (:color blue
                            :columns 4)
  "Projectile"
  ("a" projectile-ag "ag" :face 'hydra-face-orange)
  ("b" projectile-switch-to-buffer "switch to buffer")
  ("c" projectile-invalidate-cache "cache clear")
  ("d" projectile-find-dir "dir")
  ("s-f" projectile-find-file "file")
  ("ff" projectile-find-file-dwim "file dwim")
  ("fd" projectile-find-file-in-directory "file curr dir")
  ("g" ggtags-update-tags "update gtags")
  ("i" projectile-ibuffer "Ibuffer")
  ("K" projectile-kill-buffers "Kill all buffers")
  ("o" projectile-multi-occur "multi-occur")
  ("p" projectile-switch-project "switch")
  ("r" projectile-recentf "recent file")
  ("x" projectile-remove-known-project "remove known")
  ("X" projectile-cleanup-known-projects "cleanup non-existing")
  ("z" projectile-cache-current-file "cache current")
  ("q" nil "cancel"))
master
Oleh Krehel 11 years ago
parent 1e9276adfe
commit 7aa8187957
  1. 15
      hydra.el

@ -505,13 +505,14 @@ HEAD's binding is returned as a string with a colored face."
"%%"
(car head))
'face
(cl-case head-color
(blue 'hydra-face-blue)
(red 'hydra-face-red)
(amaranth 'hydra-face-amaranth)
(pink 'hydra-face-pink)
(teal 'hydra-face-teal)
(t (error "Unknown color for %S" head))))))
(or (hydra--head-property head :face)
(cl-case head-color
(blue 'hydra-face-blue)
(red 'hydra-face-red)
(amaranth 'hydra-face-amaranth)
(pink 'hydra-face-pink)
(teal 'hydra-face-teal)
(t (error "Unknown color for %S" head)))))))
(defun hydra-fontify-head-greyscale (head _body)
"Produce a pretty string from HEAD and BODY.

Loading…
Cancel
Save