[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/moe-theme ac0bff2881 151/352: Avoid unnecessary load-theme
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/moe-theme ac0bff2881 151/352: Avoid unnecessary load-theme and screen flashing when changing color of |
Date: |
Fri, 7 Jan 2022 03:59:16 -0500 (EST) |
branch: elpa/moe-theme
commit ac0bff288107522e2ba0a7b91997a74c46399d5b
Author: kuanyui <azazabc123@gmail.com>
Commit: kuanyui <azazabc123@gmail.com>
Avoid unnecessary load-theme and screen flashing when changing color of
mode-line or Powerline.
---
moe-theme.el | 42 +++++++++++++++++++++++++++++-------------
1 file changed, 29 insertions(+), 13 deletions(-)
diff --git a/moe-theme.el b/moe-theme.el
index fc4e31d447..c985955263 100644
--- a/moe-theme.el
+++ b/moe-theme.el
@@ -14,6 +14,7 @@
;;; Commentary:
;; You can take a look at screenshots and acquire more information on:
+;;
;; https://github.com/kuanyui/moe-theme.el
;;
;;
@@ -31,6 +32,11 @@
;; or
;; (moe-light)
;;
+;; But if you want to install manually, add this first:
+;;
+;; (add-to-list 'custom-theme-load-path "~/path/to/moe-theme")
+;; (add-to-list 'load-path "~/path/to/moe-theme")
+;;
;; = Customizations
============================================================
;;
;; It's impossible to satisfy everyone with one theme, so `moe-theme`
provide
@@ -181,6 +187,12 @@ of each level.
If the value is t, the titles will be resized by its level.
If the vaule is nil, all the outlines will be the same size.")
+(defvar moe-theme-revert-theme t
+ "When call (moe-light) or (moe-dark), `load-theme' & `set-background-color'
+ (they would cause screen flashing) again or not. If doesn't need load-theme,
+set this to nil temporarily: (let (moe-theme-revert-theme) ...)
+DO NOT CHANGE ITS VALUE.")
+
(defun moe-theme-resize-font-size ()
(when (and (listp moe-theme-resize-markdown-title)
(not (null moe-theme-resize-markdown-title))
@@ -242,12 +254,13 @@ If the vaule is nil, all the outlines will be the same
size.")
(defun moe-light ()
"Load moe-light-theme with your customizations."
(interactive)
- (load-theme 'moe-light t)
- (moe-theme-resize-font-size)
+ (if (not (null moe-theme-revert-theme)) ;Avoid unnecessary flashing screen
when using random-color
+ (progn (load-theme 'moe-light t)
+ (moe-theme-resize-font-size)
- (if (and (not (null moe-light-pure-white-background-in-terminal))
- (null (window-system)))
- (set-face-attribute 'default nil :background "#ffffff" :foreground
"#5f5f5f"))
+ (if (and (not (null moe-light-pure-white-background-in-terminal))
+ (null (window-system)))
+ (set-face-attribute 'default nil :background "#ffffff"
:foreground "#5f5f5f"))))
(cond ((eq moe-theme-mode-line-color 'blue) ;要考慮到powerline的顏色搭配...orz
(set-face-attribute 'mode-line nil :background "#5fafd7" :foreground
"#ffffff")
@@ -295,7 +308,8 @@ If the vaule is nil, all the outlines will be the same
size.")
(defun moe-dark ()
"Load moe-light-theme with your customizations."
(interactive)
- (load-theme 'moe-dark t)
+ (if (not (null moe-theme-revert-theme))
+ (load-theme 'moe-dark t))
(moe-theme-resize-font-size)
(cond ((eq moe-theme-mode-line-color 'blue) ;要考慮到powerline的顏色搭配...orz
(set-face-attribute 'mode-line nil :background "#afd7ff" :foreground
"#005f87")
@@ -359,9 +373,10 @@ You may also like `moe-theme-random-color'"
"Select a color: "
'((blue) (green) (orange) (magenta) (yellow) (purple) (red)
(cyan) (w/b))
nil t "" nil nil t)))
- (if (eq (frame-parameter nil 'background-mode) 'light)
- (moe-light)
- (moe-dark))
+ (let (moe-theme-revert-theme)
+ (if (eq (frame-parameter nil 'background-mode) 'light)
+ (moe-light)
+ (moe-dark)))
(if (eq moe-theme-powerline-enable-p t)
(powerline-moe-theme)))
@@ -375,9 +390,10 @@ You may also like `moe-theme-random-color'"
(moe-theme-random-color)
(setq moe-theme-mode-line-color (elt color-list n)))
- (if (eq (frame-parameter nil 'background-mode) 'light)
- (moe-light)
- (moe-dark))
+ (let (moe-theme-revert-theme)
+ (if (eq (frame-parameter nil 'background-mode) 'light)
+ (moe-light)
+ (moe-dark)))
(if (eq moe-theme-powerline-enable-p t)
(powerline-moe-theme))))
@@ -398,7 +414,7 @@ as long as setq `moe-theme-mode-line-color' first."
(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
"#949494" :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)
- [nongnu] elpa/moe-theme 870ce6a117 103/352: Update faces for new Magit., (continued)
- [nongnu] elpa/moe-theme 870ce6a117 103/352: Update faces for new Magit., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme a99afddb3e 107/352: Add support for ido-mode, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 35106fd492 147/352: Update manuals., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme ff7692b0bf 122/352: Mode line subtle modification., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 6664bbbe98 136/352: Some new faces for latest version Magit, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme f6a6348b67 133/352: Flycheck and Malabar, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme da3380bf1c 118/352: Diff & EDiff., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme c1e9a7f8a4 178/352: I've hesitated for a long time -- Which type-face looks better, clear, and distinguishing..., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 3388d3590c 146/352: Fix typo bug., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 799540922e 160/352: If (featurep 'powerline) is nil, don't defun powerline-moe-theme., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme ac0bff2881 151/352: Avoid unnecessary load-theme and screen flashing when changing color of,
ELPA Syncer <=
- [nongnu] elpa/moe-theme 76cf341926 129/352: gnus, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme d369c07469 176/352: Improve org-document-* faces., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 1e806b04e5 119/352: Improve faces for Diff., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 60d72ee906 167/352: Merge branch 'master' of github.com:kuanyui/moe-theme.el, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 8d423f5aad 149/352: Correct installation guide., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme ddc6c495e1 226/352: Merge pull request #39 from oppenlander/remove-cl-dependency, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 01055276a5 187/352: Merge pull request #30 from kuanyui/pr/28, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 7dd78f8d63 204/352: Fix some wrong faces., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 86c768059a 245/352: Add TOC for README, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 1e40bd6572 271/352: Fix issue #63. compilation-*, ELPA Syncer, 2022/01/07