branch: elpa/moe-theme
commit 6eb5fc117294f45a5a0ffbe9b9123b7bb16f4695
Merge: 54c3e397ca 17fd13780c
Author: kuanyui <[email protected]>
Commit: kuanyui <[email protected]>
Merge tanzoniteblack's refactoring for select-color and random-color.
---
README.md | 7 +++----
moe-theme.el | 35 ++++++++++++++++++-----------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/README.md b/README.md
index 5c9558aba9..58348f1e5d 100644
--- a/README.md
+++ b/README.md
@@ -97,10 +97,10 @@ The values should be lists. Larger the values, larger the
fonts.
If you don't like this, just leave them nil, and all the titles will be the
same size.
### Colorful Mode-line and Powerline
-Tired of boring blue mode-line? You can set default mode-line color. moe-theme
provides 9 colors mode-line style. Add following lines **before** `(moe-light)`
or `(moe-dark)`:
+Tired of boring blue mode-line? You can set default mode-line color. moe-theme
provides 9 colors mode-line style. Add following lines **after** `(moe-light)`
or `(moe-dark)`:
```lisp
- (setq moe-theme-mode-line-color 'orange)
+ (moe-theme-set-color 'orange)
;; (Available colors: blue, orange, green ,magenta, yellow, purple, red,
cyan, w/b.)
```
@@ -168,7 +168,7 @@ If your terminal emulator doesn't render 256-color output
correctly, set its env
TERM=xterm-256color
If you also use `tmux`, add this to `~/.tmux.conf`, too:
-
+
set -g default-terminal "screen-256color"
### Paren
@@ -191,4 +191,3 @@ Can't bear a mode with an ugly looking? `moe-theme` doesn't
support the mode you
## License
`moe-theme.el` (include images) is released under GPL v3. Copyleft is so cute!
-
diff --git a/moe-theme.el b/moe-theme.el
index f64aad2d23..71a105c339 100644
--- a/moe-theme.el
+++ b/moe-theme.el
@@ -377,15 +377,12 @@ Don't setq this manually.")
;; Powerline
-(defun moe-theme-select-color ()
- "Select the color of mode-line you like. (Notice: we support Powerline :D)
-You may also like `moe-theme-random-color'"
- (interactive)
+(defun moe-theme-set-color (color)
+ "Set the COLOR of mode-line you like. You may also like
+`moe-theme-random-color' This should be called
+programmly (e.g. in init.el), not interactively."
(setq moe-theme-mode-line-color
- (intern (completing-read
- "Select a color: "
- '((blue) (green) (orange) (magenta) (yellow) (purple) (red)
(cyan) (w/b))
- nil t "" nil nil t)))
+ color)
(let (moe-theme-revert-theme) ;set to nil to change only mode-line's color
(if (eq (frame-parameter nil 'background-mode) 'light)
(moe-light)
@@ -393,22 +390,26 @@ You may also like `moe-theme-random-color'"
(if (eq moe-theme-powerline-enable-p t)
(powerline-moe-theme)))
+(defun moe-theme-select-color ()
+ "Interactively select the color of mode-line you like and set
+it. (Notice: we support Powerline :D) You may also like
+`moe-theme-random-color'"
+ (interactive)
+ (moe-theme-set-color (intern (completing-read
+ "Select a color: "
+ '((blue) (green) (orange) (magenta) (yellow) (purple) (red)
(cyan) (w/b))
+ nil t "" nil nil t))))
+
(defun moe-theme-random-color ()
- "Give me a random mode-line color.=w=+"
+ "Give me a random mode-line color.=w=+
+This function can be called both programmly and interactively."
(interactive)
(let* ((n (abs (% (random) 9)))
(current-color moe-theme-mode-line-color)
(color-list '(blue green orange magenta yellow purple red cyan w/b)))
(if (eq (elt color-list n) current-color) ;If gotten color eq
current-color, random again.
(moe-theme-random-color)
- (setq moe-theme-mode-line-color (elt color-list n)))
-
- (let (moe-theme-revert-theme) ;set to nil to change only mode-line's color
- (if (eq (frame-parameter nil 'background-mode) 'light)
- (moe-light)
- (moe-dark)))
- (if (eq moe-theme-powerline-enable-p t)
- (powerline-moe-theme))))
+ (moe-theme-set-color (elt color-list n)))))
(when (require 'powerline nil :no-error)
(defadvice powerline-revert (after moe-theme-powerline-revert activate)