branch: elpa/moe-theme
commit 799540922eb5e396d6fd26e147af24f916efddd9
Author: kuanyui <[email protected]>
Commit: kuanyui <[email protected]>
If (featurep 'powerline) is nil, don't defun powerline-moe-theme.
---
moe-theme.el | 109 +++++++++++++++++++++++++++++------------------------------
1 file changed, 53 insertions(+), 56 deletions(-)
diff --git a/moe-theme.el b/moe-theme.el
index a2dda55b12..272daf2460 100644
--- a/moe-theme.el
+++ b/moe-theme.el
@@ -411,60 +411,24 @@ You may also like `moe-theme-random-color'"
(if (eq moe-theme-powerline-enable-p t)
(powerline-moe-theme))))
-(if (commandp 'powerline-revert)
- (defadvice powerline-revert (after moe-theme-powerline-revert activate)
- "Auto set `moe-theme-powerline-enable-p' to nil after `powerline-revert'
+(when (featurep 'powerline)
+ (defadvice powerline-revert (after moe-theme-powerline-revert activate)
+ "Auto set `moe-theme-powerline-enable-p' to nil after `powerline-revert'
Because when `powerline-moe-theme' has been run, `moe-theme-select-color'
and `moe-theme-random-color' should call `powerline-moe-theme' again for
update."
- (setq moe-theme-powerline-enable-p nil)))
+ (setq moe-theme-powerline-enable-p nil))
-(defun powerline-moe-theme ()
- "Powerline theme powered by moe-theme.el
+ (defun powerline-moe-theme ()
+ "Powerline theme powered by moe-theme.el
It's recommended use this with `moe-light' or `moe-dark', but it's ok without
them,
as long as setq `moe-theme-mode-line-color' first."
- (interactive)
- (if (commandp 'powerline-default-theme)
- (progn
- (cond ((eq (frame-parameter nil 'background-mode) 'light)
- (set-face-attribute 'mode-line-buffer-id nil :background nil
:foreground "#1c1c1c")
- (set-face-attribute 'mode-line-inactive nil :background
"#b2b2b2" :foreground "#ffffff")
- (set-face-attribute 'powerline-active2 nil :background
"#585858" :foreground "#ffffff")
- (set-face-attribute 'powerline-inactive1 nil :background
"#c6c6c6" :foreground "#585858")
- (set-face-attribute 'powerline-inactive2 nil :background
"#e4e4e4" :foreground "#585858")
- (cond ((eq moe-theme-mode-line-color 'blue)
- (set-face-attribute 'mode-line nil :background "#5fafd7"
:foreground "#ffffff")
- (set-face-attribute 'powerline-active1 nil :background
"#afd7ff" :foreground "#005faf"))
- ((eq moe-theme-mode-line-color 'green)
- (set-face-attribute 'mode-line nil :background "#a1db00"
:foreground "#005f00")
- (set-face-attribute 'powerline-active1 nil :background
"#d7ff87" :foreground "#008700"))
- ((eq moe-theme-mode-line-color 'orange)
- (set-face-attribute 'mode-line nil :background "#ff8700"
:foreground "#ffffff")
- (set-face-attribute 'powerline-active1 nil :background
"#ffd787" :foreground "#d75f00"))
- ((eq moe-theme-mode-line-color 'magenta)
- (set-face-attribute 'mode-line nil :background "#ff4ea3"
:foreground "#ffffff")
- (set-face-attribute 'powerline-active1 nil :background
"#ffafff" :foreground "#ff1f8b"))
- ((eq moe-theme-mode-line-color 'yellow)
- (set-face-attribute 'mode-line nil :background "#fce94f"
:foreground "#875f00")
- (set-face-attribute 'powerline-active1 nil :background
"#ffff87" :foreground "#875f00"))
- ((eq moe-theme-mode-line-color 'purple)
- (set-face-attribute 'mode-line nil :background "#af5fd7"
:foreground "#ffffff")
- (set-face-attribute 'powerline-active1 nil :background
"#e6a8df" :foreground "#6c0099"))
- ((eq moe-theme-mode-line-color 'red)
- (set-face-attribute 'mode-line nil :background "#ff4b4b"
:foreground "#ffffff")
- (set-face-attribute 'powerline-active1 nil :background
"#ffafaf" :foreground "#cc0000"))
- ((eq moe-theme-mode-line-color 'cyan)
- (set-face-attribute 'mode-line nil :background "#5faf87"
:foreground "#ffffff")
- (set-face-attribute 'powerline-active1 nil :background
"#87d7af" :foreground "#005f5f"))
- ((eq moe-theme-mode-line-color 'w/b)
- (set-face-attribute 'mode-line nil :background "#1c1c1c"
:foreground "#ffffff")
- (set-face-attribute 'powerline-active1 nil :background
"#bcbcbc" :foreground "#3a3a3a")
- (set-face-attribute 'mode-line-buffer-id nil :background
nil :foreground "#ffffff"))))
- ((eq (frame-parameter nil 'background-mode) 'dark)
- (set-face-attribute 'mode-line-buffer-id nil :background nil
:foreground "#080808")
- (set-face-attribute 'mode-line-inactive nil :background "#4e4e4e"
:foreground "#9e9e9e")
- (set-face-attribute 'powerline-active2 nil :background "#ffffff"
:foreground "#3a3a3a")
- (set-face-attribute 'powerline-inactive1 nil :background
"#626262" :foreground "#eeeeee")
- (set-face-attribute 'powerline-inactive2 nil :background
"#767676" :foreground "#e4e4e4")
+ (interactive)
+ (cond ((eq (frame-parameter nil 'background-mode) 'light)
+ (set-face-attribute 'mode-line-buffer-id nil :background nil
:foreground "#1c1c1c")
+ (set-face-attribute 'mode-line-inactive nil :background "#b2b2b2"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-active2 nil :background "#585858"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-inactive1 nil :background
"#c6c6c6" :foreground "#585858")
+ (set-face-attribute 'powerline-inactive2 nil :background
"#e4e4e4" :foreground "#585858")
(cond ((eq moe-theme-mode-line-color 'blue)
(set-face-attribute 'mode-line nil :background "#5fafd7"
:foreground "#ffffff")
(set-face-attribute 'powerline-active1 nil :background
"#afd7ff" :foreground "#005faf"))
@@ -490,14 +454,47 @@ as long as setq `moe-theme-mode-line-color' first."
(set-face-attribute 'mode-line nil :background "#5faf87"
:foreground "#ffffff")
(set-face-attribute 'powerline-active1 nil :background
"#87d7af" :foreground "#005f5f"))
((eq moe-theme-mode-line-color 'w/b)
- (set-face-attribute 'mode-line nil :background "#ffffff"
:foreground "#080808")
+ (set-face-attribute 'mode-line nil :background "#1c1c1c"
:foreground "#ffffff")
(set-face-attribute 'powerline-active1 nil :background
"#bcbcbc" :foreground "#3a3a3a")
- (set-face-attribute 'mode-line-buffer-id nil :background
nil :foreground "#3a3a3a")))))
- (powerline-default-theme)
- (powerline-reset)
- (setq moe-theme-powerline-enable-p t))
- (message "Powerline not found. Please install first and (require
'powerline)." )))
-;; If you want to use Powerline, please run `powerline-moe-theme'
+ (set-face-attribute 'mode-line-buffer-id nil :background
nil :foreground "#ffffff"))))
+ ((eq (frame-parameter nil 'background-mode) 'dark)
+ (set-face-attribute 'mode-line-buffer-id nil :background nil
:foreground "#080808")
+ (set-face-attribute 'mode-line-inactive nil :background "#4e4e4e"
:foreground "#9e9e9e")
+ (set-face-attribute 'powerline-active2 nil :background "#ffffff"
:foreground "#3a3a3a")
+ (set-face-attribute 'powerline-inactive1 nil :background "#626262"
:foreground "#eeeeee")
+ (set-face-attribute 'powerline-inactive2 nil :background "#767676"
:foreground "#e4e4e4")
+ (cond ((eq moe-theme-mode-line-color 'blue)
+ (set-face-attribute 'mode-line nil :background "#5fafd7"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-active1 nil :background
"#afd7ff" :foreground "#005faf"))
+ ((eq moe-theme-mode-line-color 'green)
+ (set-face-attribute 'mode-line nil :background "#a1db00"
:foreground "#005f00")
+ (set-face-attribute 'powerline-active1 nil :background
"#d7ff87" :foreground "#008700"))
+ ((eq moe-theme-mode-line-color 'orange)
+ (set-face-attribute 'mode-line nil :background "#ff8700"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-active1 nil :background
"#ffd787" :foreground "#d75f00"))
+ ((eq moe-theme-mode-line-color 'magenta)
+ (set-face-attribute 'mode-line nil :background "#ff4ea3"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-active1 nil :background
"#ffafff" :foreground "#ff1f8b"))
+ ((eq moe-theme-mode-line-color 'yellow)
+ (set-face-attribute 'mode-line nil :background "#fce94f"
:foreground "#875f00")
+ (set-face-attribute 'powerline-active1 nil :background
"#ffff87" :foreground "#875f00"))
+ ((eq moe-theme-mode-line-color 'purple)
+ (set-face-attribute 'mode-line nil :background "#af5fd7"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-active1 nil :background
"#e6a8df" :foreground "#6c0099"))
+ ((eq moe-theme-mode-line-color 'red)
+ (set-face-attribute 'mode-line nil :background "#ff4b4b"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-active1 nil :background
"#ffafaf" :foreground "#cc0000"))
+ ((eq moe-theme-mode-line-color 'cyan)
+ (set-face-attribute 'mode-line nil :background "#5faf87"
:foreground "#ffffff")
+ (set-face-attribute 'powerline-active1 nil :background
"#87d7af" :foreground "#005f5f"))
+ ((eq moe-theme-mode-line-color 'w/b)
+ (set-face-attribute 'mode-line nil :background "#ffffff"
:foreground "#080808")
+ (set-face-attribute 'powerline-active1 nil :background
"#bcbcbc" :foreground "#3a3a3a")
+ (set-face-attribute 'mode-line-buffer-id nil :background nil
:foreground "#3a3a3a")))))
+ (powerline-default-theme)
+ (powerline-reset)
+ (setq moe-theme-powerline-enable-p t)))
+
(provide 'moe-theme)