Looking to apply airline-theme colors using telephone-line
AnthonyDiGirolamo opened this issue · 0 comments
Hello! Very nice package you have here. I'm looking to apply the color themes in https://github.com/AnthonyDiGirolamo/airline-themes to a telephone-line setup. The main difference between the colors there and what telephone-provides (for evil states at least) is that each face of every section can be changed depending on what the evil-state
is. Here's what I have so far which gets me most of the way.
(use-package telephone-line
:init
(setq telephone-line-lhs
'((evil . (telephone-line-evil-tag-segment))
(accent . (telephone-line-vc-segment
telephone-line-erc-modified-channels-segment
telephone-line-process-segment))
(nil . (telephone-line-minor-mode-segment
telephone-line-buffer-segment))))
(setq telephone-line-rhs
'((nil . (telephone-line-misc-info-segment))
(accent . (telephone-line-major-mode-segment))
(evil . (telephone-line-airline-position-segment))))
(defun airline/telephone-line-evil-face (active)
"Return an appropriate face for the current mode."
(let* ((evil-mode-active (featurep 'evil))
(outer-face
(if active
(if evil-mode-active
(cond ((eq evil-state (intern "normal")) 'airline-normal-outer)
((eq evil-state (intern "insert")) 'airline-insert-outer)
((eq evil-state (intern "visual")) 'airline-visual-outer)
((eq evil-state (intern "replace")) 'airline-replace-outer)
((eq evil-state (intern "emacs")) 'airline-emacs-outer)
(t 'airline-normal-outer))
'airline-normal-outer)
'powerline-inactive1))
)
outer-face))
(defun airline/telephone-line-accent-face (active)
"Return an appropriate face for the current mode."
(let* ((evil-mode-active (featurep 'evil))
(inner-face
(if active
(if evil-mode-active
(cond ((eq evil-state (intern "normal")) 'airline-normal-inner)
((eq evil-state (intern "insert")) 'airline-insert-inner)
((eq evil-state (intern "visual")) 'airline-visual-inner)
((eq evil-state (intern "replace")) 'airline-replace-inner)
((eq evil-state (intern "emacs")) 'airline-emacs-inner)
(t 'airline-normal-inner))
'airline-normal-inner)
'powerline-inactive2))
)
inner-face))
(defun airline/telephone-line-nil-face (active)
"Return an appropriate face for the current mode."
(let* ((evil-mode-active (featurep 'evil))
(center-face
(if active
(if evil-mode-active
(cond ((eq evil-state (intern "normal")) 'airline-normal-center)
((eq evil-state (intern "insert")) 'airline-insert-center)
((eq evil-state (intern "visual")) 'airline-visual-center)
((eq evil-state (intern "replace")) 'airline-replace-center)
((eq evil-state (intern "emacs")) 'airline-emacs-center)
(t 'airline-normal-center))
'airline-normal-center)
'airline-inactive3))
)
center-face))
(setq telephone-line-faces
'((evil . airline/telephone-line-evil-face)
(accent . airline/telephone-line-accent-face)
(nil . airline/telephone-line-nil-face)))
:config
(telephone-line-mode t)
)
All the colors look correct with the exception of the telephone-line-buffer-segment
part. It seems like that gets stuck as the evil normal mode color.
Am I missing something in telephone-line-faces
?
If you want to try this, install airline-themes and comment out (defun airline-themes-set-modeline
so it does nothing. Then loading any theme will just apply the colors.
diff --git a/airline-themes.el b/airline-themes.el
index 6ec89c0..45b7bc1 100644
--- a/airline-themes.el
+++ b/airline-themes.el
@@ -433,13 +433,7 @@ Valid Values: airline-directory-full, airline-directory-shortened, nil (disabled
(defun airline-themes-set-modeline ()
"Set the airline mode-line-format"
(interactive)
- (setq-default mode-line-format
- `("%e"
- (:eval
- ,(airline-themes-mode-line-format)
- )))
- (powerline-reset)
- (kill-local-variable 'mode-line-format))
+ t)
(defun airline-themes-set-deftheme (theme-name)
"Set appropriate face attributes for THEME-NAME."