1

I am using this powerline and have trouble modifying the theme.

This is my config for powerline:

;; My theme and setting for powerline

;; include original powerline
(require 'powerline)
;; theme
;; (powerline-default-theme) ;; old theme
;; (powerline-center-evil-theme)


;; handle different color based on mode
(defun MCSH-get-color ()
  "Get the collor for current mode"
  (interactive)
  (setq MCSH-evil-mode (symbol-name evil-state))
  (cond
   ((eq MCSH-evil-mode "normal") "goldenrod")
   ((eq MCSH-evil-mode "insert") "blue")
   (t "grey11") ;; Default
   ))


(defface MCSH-evil-active-face-default '((t (:background "grey11"                                            :inherit mode-line)))
  "Powerline face1."
  :group 'powerline)

(defface MCSH-evil-inactive-face-default
  '((t (:background "grey11" :inherit mode-line-inactive)))
  "Powerline face 1."
  :group 'powerline)

(defun MCSH-evil-face (active)
  (interactive)
  "Get face for current mode"
  (let* ((face (intern (concat "MCSH-evil-" (if active "active"     "inactive") "-" (symbol-name evil-state) ))))
    (if (facep face) face (intern (concat "MCSH-evil-" (if active     "active" "inactive")  "-default")))
  ))

;; my custom theme
(defun powerline-evil-MCSH-theme ()
  "Setup a mode-line with major, evil, and minor modes centered."
  (interactive)
  (setq-default mode-line-format
        '("%e"
          (:eval
           (let* ((active (powerline-selected-window-active))
              (mode-line (if active 'mode-line 'mode-line-inactive))
              (face1 (if active 'powerline-active1 'powerline-    inactive1))
              (face2 (if active 'powerline-active2 'powerline-    inactive2))
              (facemode (MCSH-evil-face active))
              ;;(facemode face1)
              (separator-left (intern (format "powerline-%s-%s"
                              (powerline-current-separator)
                              (car powerline-default-separator-    dir))))
              (separator-right (intern (format "powerline-%s-%s"
                               (powerline-current-separator)
                               (cdr powerline-default-separator-    dir))))
              (lhs (list (powerline-raw "%*" nil 'l)
                     (powerline-buffer-size nil 'l)
                     (powerline-buffer-id nil 'l)
                     (powerline-raw " ")
                     (funcall separator-left mode-line face1)
                     (powerline-narrow face1 'l)
                     (powerline-vc face1)))
              (rhs (list (powerline-raw global-mode-string face1 'r)
                     (powerline-raw "%4l" face1 'r)
                     (powerline-raw ":" face1)
                     (powerline-raw "%3c" face1 'r)
                     (funcall separator-right face1 mode-line)
                     (powerline-raw " ")
                     (powerline-raw "%6p" nil 'r)
                     (powerline-hud face2 face1)
                     ))
              (center (append (list (powerline-raw " " face1)
                        (funcall separator-left face1 face2)
                        (when (and (boundp 'erc-track-minor-mode)     erc-track-minor-mode)
                          (powerline-raw erc-modified-channels-    object face2 'l))
                        (powerline-major-mode face2 'l)
                        (powerline-process face2)
                        (powerline-raw " " face2))
                      (if (split-string (format-mode-line minor-    mode-alist))
                          (append (if evil-mode
                              (list (funcall separator-right face2     facemode)
                                (powerline-raw evil-mode-line-tag facemode 'l)
                                (powerline-raw " " facemode)
                                (funcall separator-left facemode face2)))
                              (list (powerline-minor-modes face2 'l)
                                (powerline-raw " " face2)
                                (funcall separator-right face2 face1)))
                        (list (powerline-raw evil-mode-line-tag face2)
                          (funcall separator-right face2 face1))))))
             (concat (powerline-render lhs)
                 (powerline-fill-center face1 (/ (powerline-width center) 2.0))
                 (powerline-render center)
                 (powerline-fill face1 (powerline-width rhs))
                 (powerline-render rhs)))))))

(powerline-evil-MCSH-theme)

(provide 'powerline-MCSH)

However this doesn't render properly:

Notice the gray line at the botton: Notice the gray line at bottom

If I un-comment this line

;;(facemode face1)

which would basically do what the original powerline-center-evil-theme does, the result would be:

Notice the bottom: Notice the bottom

Basically I want to change background of the face based on the evil state. But this doesn't seem to work. (as of now, only one other background is implemented but that should work because if there isn't any face it would use the default one)

1
  • In case it is needed, here is a git repo containing my stable configs (the README is outdated): github.com/MCSH/dot-files
    – MCSH
    Commented Mar 23, 2016 at 19:03

1 Answer 1

1

Okay, I can not believe I made this mistake.

There is a -face in the names, which (being new to emacs) I thought is necessary, but apparently it is part of the name (I must have misinterpreted some docs).

Removing them solved the problem.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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