[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/moe-theme fbd72901b9 217/352: Refactor moe-theme-select-co
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/moe-theme fbd72901b9 217/352: Refactor moe-theme-select-color and random-color |
Date: |
Fri, 7 Jan 2022 03:59:25 -0500 (EST) |
branch: elpa/moe-theme
commit fbd72901b961332ae83fd717d9a1b0be5da24c97
Author: Ryan Smith <rnsmith2@gmail.com>
Commit: Ryan Smith <rnsmith2@gmail.com>
Refactor moe-theme-select-color and random-color
When I used to call the follow to set my theme, it would never work
quite the same as if I directly called `moe-theme-select-color`
manually.
```elisp
(setq moe-theme-mode-line-color 'purple)
(powerline-moe-theme)
```
For example, the file completion of IDO would never change
from blue. To eleminate this, I refactored the code you were using in
`moe-theme-select-color` out into it's own function, which both
`moe-theme-select-color` and `moe-theme-random-color` now both call
rather than independantly recreating the same logic.
---
README.md | 7 +++----
moe-theme.el | 30 ++++++++++++++----------------
2 files changed, 17 insertions(+), 20 deletions(-)
diff --git a/README.md b/README.md
index c63d7498e0..14f95bd853 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.)
```
@@ -164,7 +164,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
@@ -187,4 +187,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..caa7f83b84 100644
--- a/moe-theme.el
+++ b/moe-theme.el
@@ -377,15 +377,11 @@ 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. (Notice: we support
+Powerline :D) You may also like `moe-theme-random-color'"
(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,6 +389,15 @@ You may also like `moe-theme-random-color'"
(if (eq moe-theme-powerline-enable-p t)
(powerline-moe-theme)))
+(defun moe-theme-select-color ()
+ "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=+"
(interactive)
@@ -401,14 +406,7 @@ You may also like `moe-theme-random-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)
- [nongnu] elpa/moe-theme 75dacf98d3 232/352: Merge pull request #44 from xuchunyang/patch-1, (continued)
- [nongnu] elpa/moe-theme 75dacf98d3 232/352: Merge pull request #44 from xuchunyang/patch-1, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 2277887108 208/352: Issue #33 Fixed (Add Info), ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 9b17bb872a 196/352: Remove autoload. https://github.com/kuanyui/moe-theme.el/issues/31, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 958e78ade0 223/352: Bold and Italic shouldn't be overwritten, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 70c429711d 199/352: Improve Helm faces., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme a78e0fe966 227/352: Minor improve for Helm., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 97c97995c3 210/352: Add CPerl., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 112a8b79d8 212/352: Update operator os Tuareg. Forgotten CPerl., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 33340a9aea 235/352: Merge branch 'master' of github.com:kuanyui/moe-theme.el, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 91f7e1dc17 190/352: Add "bold"., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme fbd72901b9 217/352: Refactor moe-theme-select-color and random-color,
ELPA Syncer <=
- [nongnu] elpa/moe-theme a14348d95c 188/352: Improve org-code., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 0c62a117a2 205/352: Merge branch 'master' of github.com:kuanyui/moe-theme.el, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 0c56c36d4f 236/352: Add essential faces for web-mode., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme fe4407c80d 241/352: Add support for hydra faces, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 9d5f979eb6 239/352: Remove duplicate faces, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 24006f5855 237/352: [web-mode] wrong current-element-highlight-face, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 57bca7813f 263/352: Fix issue #62., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 942ac59464 244/352: Merge pull request #50 from ssbb/master, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 39384a7a9e 268/352: moe-dark for Magit 2, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 36445fafc1 285/352: Merge pull request #74 from tanzoniteblack/avy-mode, ELPA Syncer, 2022/01/07