Add teal body color

* hydra.el (hydra-face-teal): New face.
(hydra--face): Update.
(defhydra): Teal color is the same as amaranth, except the heas inherit
blue instead of red.

This Hydra can reasonably be either blue or teal:

    (global-set-key
       (kbd "C-c C-v")
       (defhydra hydra-toggle (:color teal)
         "toggle"
         ("a" abbrev-mode "abbrev")
         ("d" toggle-debug-on-error "debug")
         ("f" auto-fill-mode "fill")
         ("t" toggle-truncate-lines "truncate")
         ("w" whitespace-mode "whitespace")
         ("q" nil "cancel")))
master
Oleh Krehel 11 years ago
parent 42cb833d5a
commit 6f7cef2600
  1. 14
      hydra.el

@ -122,6 +122,12 @@ Vanquishable only through a blue head.")
'((t (:foreground "#FF6EB4" :bold t))) '((t (:foreground "#FF6EB4" :bold t)))
"Pink body has red heads and on intercepting non-heads calls them without quitting. "Pink body has red heads and on intercepting non-heads calls them without quitting.
Vanquishable only through a blue head.") Vanquishable only through a blue head.")
(defface hydra-face-teal
'((t (:foreground "#367588" :bold t)))
"Teal body has blue heads an warns on intercepting non-heads.
Vanquishable only through a blue head.")
;;* Fontification ;;* Fontification
(defun hydra-add-font-lock () (defun hydra-add-font-lock ()
"Fontify `defhydra' statements." "Fontify `defhydra' statements."
@ -235,6 +241,7 @@ BODY is the second argument to `defhydra'"
(red 'hydra-face-red) (red 'hydra-face-red)
(amaranth 'hydra-face-amaranth) (amaranth 'hydra-face-amaranth)
(pink 'hydra-face-pink) (pink 'hydra-face-pink)
(teal 'hydra-face-teal)
(t (error "Unknown color for %S" h)))) (t (error "Unknown color for %S" h))))
(defun hydra-cleanup () (defun hydra-cleanup ()
@ -473,7 +480,7 @@ result of `defhydra'."
(setq body-pre `(funcall #',body-pre))) (setq body-pre `(funcall #',body-pre)))
(when (and body-post (symbolp body-post)) (when (and body-post (symbolp body-post))
(setq body-post `(funcall #',body-post))) (setq body-post `(funcall #',body-post)))
(when (memq body-color '(amaranth pink)) (when (memq body-color '(amaranth pink teal))
(if (cl-some `(lambda (h) (if (cl-some `(lambda (h)
(eq (hydra--head-color h ',body-color) 'blue)) (eq (hydra--head-color h ',body-color) 'blue))
heads) heads)
@ -488,8 +495,9 @@ result of `defhydra'."
`(lambda () `(lambda ()
(interactive) (interactive)
,@(if ,@(if
(eq body-color 'amaranth) (memq body-color '(amaranth teal))
'((message "An amaranth Hydra can only exit through a blue head")) `((message ,(format "An %S Hydra can only exit through a blue head"
body-color)))
'((let ((kb (key-binding (this-command-keys)))) '((let ((kb (key-binding (this-command-keys))))
(if kb (if kb
(if (commandp kb) (if (commandp kb)

Loading…
Cancel
Save