emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/moe-theme 6bc62a7c78 145/352: Add Customizations!!! :heart


From: ELPA Syncer
Subject: [nongnu] elpa/moe-theme 6bc62a7c78 145/352: Add Customizations!!! :heart:
Date: Fri, 7 Jan 2022 03:59:15 -0500 (EST)

branch: elpa/moe-theme
commit 6bc62a7c78360d9f09af76667d59e5c5f00e2645
Author: kuanyui <azazabc123@gmail.com>
Commit: kuanyui <azazabc123@gmail.com>

    Add Customizations!!! :heart:
---
 README.md             |  67 +++++++--
 moe-dark-theme.el     |   4 +-
 moe-light-theme.el    |   4 +-
 moe-theme-switcher.el |  41 +++---
 moe-theme.el          | 401 ++++++++++++++++++++++++++++++++++++++++++++++----
 5 files changed, 458 insertions(+), 59 deletions(-)

diff --git a/README.md b/README.md
index f2b3be492d..83ae62b3ef 100644
--- a/README.md
+++ b/README.md
@@ -40,33 +40,74 @@
 * Emacs 24 or above.
 * 256-colors (or higher) terminal.
 
-## Install
+## Download
 ### Via package.el
 `Moe-theme` is available in [MELPA](https://github.com/milkypostman/melpa) 
repository now, so you can install `moe-theme` easily with `M-x` 
`list-packages`.
 
-If you want `moe-theme` to load automatically as Emacs startup, take 
`moe-dark` for example, you can use:
-
-```lisp
-       (load-theme 'moe-dark t)
-```
-
 ### Manually
 Download the archive of `moe-theme` to `~/.emacs.d/themes` and extract it. 
Then, add these to your init file:
 
 ```lisp
        ;;customize theme
        (add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
-       (load-theme 'moe-dark t)
 ```
-    
-Or you can load theme just by adding:    
+
+## Customizations
+It's impossible to satisfy everyone with one theme, but `moe-theme` provide 
some customizations that you may like it
+
+Select a theme you like and go on:
+
+```lisp
+    (require 'moe-theme)
+    ;; Choose the one you like, (moe-light) or (moe-dark)
+    (moe-light)
+```
+
+>#### Load Theme Itself Only?
+>If you just want to use `load-theme` to apply **ONLY** `moe-theme` itself and 
**without customizations**, you can skip "Customizations" chapter and just use 
this:
+>
+>```lisp
+>    (load-theme 'moe-dark t)
+>    ;;or
+>    (load-theme 'moe-light t)
+>```
+
+### Resize Titles
+You may want to resize titles in `markdown-mode`, `org-mode`, or 
`ReStructuredText-mode`:
 
 ```lisp
-    (load-file "~/.emacs.d/themes/moe-dark-theme.el")
+  ;; Resize titles
+  (setq moe-theme-resize-markdown-title '(2.0 1.7 1.5 1.3 1.0 1.0))
+  (setq moe-theme-resize-org-title '(2.2 1.8 1.6 1.4 1.2 1.0 1.0 1.0 1.0))
+  (setq moe-theme-resize-rst-title '(2.0 1.7 1.5 1.3 1.1 1.0))
 ```
+>Markdown should have 6 items; org has 9 items; rst has 6 items.
 
-(Note: `moe-light-theme.el` and `moe-dark-theme.el` are independent from each 
other, so you can just download one of them.)
+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? Set default mode-line color like this:
+```lisp
+  (setq moe-theme-mode-line-color 'orange)
+  ;; (Available colors: blue, orange, magenta, yellow, purple, red, cyan, w/b.)
+```
+
+You can use `moe-theme-select-color` to change color interactively.
+
+Mayby you'll also like `moe-theme-random-color`, which gives you a random mood 
:D.
+
+#### Powerline
+Now `moe-theme` supports 
[Powerline](https://github.com/milkypostman/powerline), which makes mode-line 
looks fabulous! We recommended installing `powerline` and run 
`powerline-moe-theme`.
+
+### Too Yellow Background?
+With 256-colors, default yellow background of moe-light may be too yellow on 
some screens.
+
+If you encounter this problem, and want to set background color to `#ffffff` 
in terminal, set the value of `moe-light-pure-white-background-in-terminal` to 
t:
+
+```lisp
+    (setq moe-light-pure-white-background-in-terminal t)
+```
 ## Have A Good Mood Today?
 I prefer a terminal with a black-on-white color scheme. I found that in the 
daytime, sunlight is strong and black-on-white is more readable; However, 
white-on-black would be less harsh to the eyes at night.
 
@@ -94,7 +135,7 @@ Take "Keelung, Taiwan" (25N,121E) for example, you can set 
like this:
        (setq calendar-longitude +121)
 ```
 
-## Note
+## Notes
 ### No 256-Color Output?
 If your terminal emulator doesn't render 256-color output correctly, set its 
environment variable `TERM` to `xterm-256color`. For example, if you are using 
`Konsole`, navigate to `Edit Current Profile > General > Environment > Edit` 
and add the following line:
 
diff --git a/moe-dark-theme.el b/moe-dark-theme.el
index d914ba15a5..ba1f4c97cd 100644
--- a/moe-dark-theme.el
+++ b/moe-dark-theme.el
@@ -16,7 +16,7 @@ Moe, moe, kyun!")
       (magenta-1 "#ff7bbb") (magenta-2 "#ff4ea3") (magenta-3 "#ff1f8b")
       (green-1 "#afff00") (green-2 "#a1db00") (green-3 "#5faf00") (green-4 
"#008700") (green-5 "#005f00")
       (blue-1 "#5fafd7") (blue-2 "#1f5bff") (blue-3 "#005f87") (blue-4 
"#005faf") (blue-5 "#0000af")
-      (cyan-1 "#87ffff") (cyan-2 "#87d7af") (cyan-3 "#00d7af") (cyan-4 
"#00ac8a") (cyan-5 "#5faf87")
+      (cyan-1 "#87ffff") (cyan-2 "#87d7af") (cyan-3 "#00d7af") (cyan-4 
"#00ac8a") (cyan-5 "#5faf87") (cyan-6 "#005f5f") (cyan-7 "#005f87")
       (purple-1 "#d18aff") (purple-2 "#af5fff") (purple-3 "#9a08ff") (purple-4 
"#6c0099")
       (red-1 "#ef2929")  (red-2 "#dd0000")  (red-3 "#a40000")
       (white-1 "#c6c6c6") (white-2 "#c6c6c6") (white-3 "#b2b2b2") (black-1 
"#a8a8a8") (black-2 "#8a8a8a")
@@ -654,6 +654,8 @@ Moe, moe, kyun!")
       (set-background-color "#303030")
       (set-foreground-color "#c6c6c6")))
 
+(setq moe-theme-which-enabled 'dark)
+
 (provide-theme 'moe-dark)
 
 ;; Local Variables:
diff --git a/moe-light-theme.el b/moe-light-theme.el
index b1c65588dd..2a15d6ec80 100644
--- a/moe-light-theme.el
+++ b/moe-light-theme.el
@@ -16,7 +16,7 @@ Moe, moe, kyun!")
       (magenta-1 "#ff7bbb") (magenta-2 "#ff4ea3") (magenta-3 "#ff1f8b")
       (green-1 "#afff00") (green-2 "#a1db00") (green-3 "#00af00") (green-4 
"#008700") (green-5 "#005f00")
       (blue-1 "#5fafd7") (blue-2 "#1f5bff") (blue-3 "#005f87") (blue-4 
"#005faf") (blue-5 "#0000af")
-      (cyan-1 "#87ffff") (cyan-2 "#87d7af") (cyan-3 "#00d7af") (cyan-4 
"#00ac8a") (cyan-5 "#5faf87")
+      (cyan-1 "#87ffff") (cyan-2 "#87d7af") (cyan-3 "#00d7af") (cyan-4 
"#00ac8a") (cyan-5 "#5faf87") (cyan-6 "#005f5f") (cyan-7 "#005f87")
       (purple-1 "#d18aff") (purple-2 "#9a08ff") (purple-3 "#6c0099") (purple-4 
"#6c0099")
       (red-1 "#ef2929")  (red-2 "#cc0000")  (red-3 "#a40000")
       (white-1 "#eeeeee") (white-2 "#dadada") (white-3 "#c6c6c6") (white-4 
"#b2b2b2") (black-1 "#9e9e9e")
@@ -653,6 +653,8 @@ Moe, moe, kyun!")
       (set-background-color "#fdfde7")
       (set-foreground-color "#5f5f5f")))
 
+(setq moe-theme-which-enabled 'light)
+
 (provide-theme 'moe-light)
 
 ;; Local Variables:
diff --git a/moe-theme-switcher.el b/moe-theme-switcher.el
index 0c83c04798..edb139ef7e 100644
--- a/moe-theme-switcher.el
+++ b/moe-theme-switcher.el
@@ -7,6 +7,7 @@
 
 (require 'moe-dark-theme)
 (require 'moe-light-theme)
+(require 'moe-theme)
 
 (defvar moe-theme-switch-by-sunrise-and-sunset t
 "Automatically switch between dark and light moe-theme.
@@ -21,25 +22,25 @@ Take Keelung, Taiwan(25N,121E) for example, you can set 
like this:
        (setq calendar-longitude +121)"
 )
 
-(defvar moe-now nil
-  "Variable recording which theme (moe-dark or light) is being used.")
+(defvar moe-theme-which-enabled nil
+  "Variable indicate which theme (moe-dark or light) is being used.")
 
 (defun moe-load-theme (switch-to)
   "Avoid unnecessary load-theme and screen flashing in GUI version Emacs"
-  (cond ((equal switch-to "light")
-         (if (not (equal moe-now "light"))
-           (progn (load-theme 'moe-light t)
-                  (setq moe-now "light"))))
-        ((equal switch-to "dark")
-         (if (not (equal moe-now "dark"))
-           (progn (load-theme 'moe-dark t)
-                  (setq moe-now "dark"))))))
+  (cond ((equal switch-to 'light)
+         (if (not (equal moe-theme-which-enabled 'light))
+           (progn (moe-light)
+                  (setq moe-theme-which-enabled 'light)))) ;[FIXME] Maybe 
unnecessary
+        ((equal switch-to 'dark)
+         (if (not (equal moe-theme-which-enabled 'dark))
+           (progn (moe-dark)
+                  (setq moe-theme-which-enabled 'dark)))))) ;[FIXME] Maybe 
unnecessary
 
 (defun switch-at-fixed-time ()
   (let ((now (string-to-int (format-time-string "%H"))))
     (if (and (>= now 06) (<= now 18))
-        (moe-load-theme "light")
-      (moe-load-theme "dark"))
+        (moe-load-theme 'light)
+      (moe-load-theme 'dark))
     nil))
 
 ;; (Thanks for letoh!)
@@ -92,9 +93,9 @@ Take Keelung, Taiwan(25N,121E) for example, you can set like 
this:
 ;; Excute every minute.
 (defun switch-by-locale ()
   (if (equal 24h/sunrise 'polar-night)  ;If polar-night...moe-dark!
-      (moe-load-theme "dark")
+      (moe-load-theme 'dark)
     (if (equal 24h/sunrise 'midnight-sun) ;If midnight-sun...moe-light!
-        (moe-load-theme "light")
+        (moe-load-theme 'light)
       (progn
        (let ((now (list (string-to-number (format-time-string "%H"))
                         (string-to-number (format-time-string "%M")))))
@@ -108,8 +109,8 @@ Take Keelung, Taiwan(25N,121E) for example, you can set 
like this:
                    (and 
                     (= (car now) (car 24h/sunset)) 
                     (< (second now) (second 24h/sunset)))))
-             (moe-load-theme "light")
-           (moe-load-theme "dark")
+             (moe-load-theme 'light)
+           (moe-load-theme 'dark)
            ))))))
 
 (defun moe-theme-auto-switch ()
@@ -130,10 +131,14 @@ Take Keelung, Taiwan(25N,121E) for example, you can set 
like this:
   ()
   )
 
+(setq moe-timer (run-with-timer 0 (* 1 60) 'moe-theme-auto-switch))
 
-(moe-theme-auto-switch)
+;; [FIXME] A minor-mode to enable/disable moe-theme-switcher
+(defun moe-theme-switcher-disable ()
+  (interactive)
+  (cancel-timer moe-timer))
 
-(run-with-timer 0 (* 1 60) 'moe-theme-auto-switch)
+(moe-theme-auto-switch)
 
 (provide 'moe-theme-switcher)
 
diff --git a/moe-theme.el b/moe-theme.el
index 045ef92261..7dc00ff0f2 100644
--- a/moe-theme.el
+++ b/moe-theme.el
@@ -1,10 +1,10 @@
 ;;; moe-theme --- A colorful eye-candy theme. Moe, moe, kyun!
 
-;; This program is not part of GNU Emacs. 
-;; But it is distributed under GPL v3 :-)
+;; This program is not part of GNU Emacs, but it is distributed under GPL v3 
:-)
+;;
+;; This file is established for packaging. If you want to install manually,
+;; check README.md
 ;;
-;; This file is established for packaging. If you want to install manually, 
check README.md!
-;; 
 ;; Author: kuanyui <azazabc123@gmail.com>
 ;; Keywords: themes
 ;; X-URL: https://github.com/kuanyui/moe-theme.el
@@ -15,45 +15,56 @@
 
 ;; You can take a look at screenshots and acquire more information on:
 ;;     https://github.com/kuanyui/moe-theme.el
-;; 
+;;
 ;;
 ;; Requirements
-;; 
+;;
 ;;   - Emacs 24 (or above)
 ;;   - 256 colors terminal (or higher)
 ;;
 ;; Usage
-;; 
+;;
 ;;   Add you to your .emacs:
 ;;
 ;;     (load-theme 'moe-dark t)
 ;;                or
 ;;     (load-theme 'moe-light t)
-;; 
-;;                
+;;
+;;
 ;; Auto Switching
-;; 
-;;   I prefer a terminal with a black-on-white color scheme. I found that in 
the daytime, sunlight is strong and black-on-white is more readable; However, 
white-on-black would be less harsh to the eyes at night.
+;;
+;;   I prefer a terminal with a black-on-white color scheme. I found that in 
the
+;; daytime, sunlight is strong and black-on-white is more readable; However,
+;; white-on-black would be less harsh to the eyes at night.
 
-;;   So if you like, you can add the following line to your ~/.emacs to 
automatically switch between moe-dark and moe-light according to the system 
time:
+;;   So if you like, you can add the following line to your ~/.emacs to
+;; automatically switch between moe-dark and moe-light according to the system
+;; time:
 ;;
 ;;     (require 'moe-theme-switcher)
-;; 
-;;   By adding the line above, your Emacs will have a light theme in the day 
and a dark one at night. =w=+
-;; 
-;; 
+;;
+;;   By adding the line above, your Emacs will have a light theme in the day
+;;  and a dark one at night. =w=+
+;;
+;;
 ;; Live in Antarctica?
-;; 
-;;   Daytime is longer in summer but shorter in winter; or you live in a high 
latitude region which midnight-sun or polar-night may occur such as Finland or 
Antarctica?
-;; 
-;;   There's a variable `moe-theme-switch-by-sunrise-and-sunset` would solve 
your problem (default value is `t`)
-;; 
-;;   If this value is `nil`, `moe-theme-switcher` will switch theme at fixed 
time (06:00 and 18:00).
-;; 
-;;   If this value is `t` and both `calendar-latitude` and 
`calendar-longitude` are set properly, the switching will be triggered at the 
sunrise and sunset time of the local calendar.
-;; 
+;;
+;;   Daytime is longer in summer but shorter in winter; or you live in a high
+;; latitude region which midnight-sun or polar-night may occur such as Finland
+;; or Antarctica?
+;;
+;;   There's a variable `moe-theme-switch-by-sunrise-and-sunset` would solve
+;; your problem (default value is `t`)
+;;
+;;   If this value is `nil`, `moe-theme-switcher` will switch theme at fixed
+;; time (06:00 and 18:00).
+;;
+;;   If this value is `t` and both `calendar-latitude` and `calendar-longitude`
+;; are set properly, the switching will be triggered at the sunrise and sunset
+;; time of the local calendar.
+;;
 ;;   Take "Keelung, Taiwan" (25N,121E) for example, you can set like this:
-;; 
+;;
 ;;     (setq calendar-latitude +25)
 ;;     (setq calendar-longitude +121)
 
@@ -64,6 +75,344 @@
   (add-to-list 'custom-theme-load-path
                (file-name-as-directory (file-name-directory load-file-name))))
 
+(defvar moe-theme-highlight-buffer-id t
+  "If t, highlight buffer-id on mode-line.
+If nil, just bold buffer-id without highlight")
+
+(defvar moe-theme-mode-line-color 'blue
+  "Default is 'blue.
+If nil, no background color.
+Available choices: 'blue, 'green, 'magenta, 'red, 'orange, 'yellow, 'purple, 
'b/w")
+
+(defvar moe-light-pure-white-background-in-terminal nil
+  "With 256-colors, default yellow background of moe-light may be 'too yellow'
+on some screen.
+
+If you encounter this problem, and want to have a background of #ffffff, set
+the value of `moe-light-pure-white-background-in-terminal' to t.")
+
+;; The variable `moe-theme-resize-title-fonts`
+(defvar moe-theme-resize-markdown-title nil
+  "Resize header/title faces of Markdown-mode or not. (default value is nil)
+The value should be a list with 6 items of number, which decide title font 
sizes
+of each level.
+
+  (setq moe-theme-resize-markdown-title '(2.0 1.7 1.5 1.3 1.0 1.0))
+
+If the vaule is nil, all the titles will be the same size.")
+
+(defvar moe-theme-resize-org-title nil
+  "Resize outline/title faces of Org-mode or not. (default value is nil)
+
+The value should be a list with 9 items of number; which decide title font 
sizes
+of each level. The first item is the font size of `org-document-title', from
+second to ninth is outlines of 1-8.
+For example, you can set like this:
+
+  (setq moe-theme-resize-org-title '(2.2 1.8 1.6 1.4 1.2 1.0 1.0 1.0 1.0))
+
+If the vaule is nil, all the outlines will be the same size.")
+
+(defvar moe-theme-resize-rst-title nil
+  "Resize title faces of ReStructuredText-mode or not. (default value is nil)
+The value should be a list with 6 items of number, which decide title font 
sizes
+of each level.
+
+  (setq moe-theme-resize-rst-title '(2.0 1.7 1.5 1.3 1.1 1.0))
+
+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.")
+
+(defun moe-theme-resize-font-size ()
+  (when (and (listp moe-theme-resize-markdown-title)
+             (not (null moe-theme-resize-markdown-title))
+             (>= (length moe-theme-resize-markdown-title) 6))
+    (let* ((s1 (car moe-theme-resize-markdown-title))
+           (s2 (cadr moe-theme-resize-markdown-title))
+           (s3 (third moe-theme-resize-markdown-title))
+           (s4 (fourth moe-theme-resize-markdown-title))
+           (s5 (fifth moe-theme-resize-markdown-title))
+           (s6 (sixth moe-theme-resize-markdown-title)))
+      (progn (require 'markdown-mode)
+             (set-face-attribute 'markdown-header-face-1 nil :height s1)
+             (set-face-attribute 'markdown-header-face-2 nil :height s2)
+             (set-face-attribute 'markdown-header-face-3 nil :height s3)
+             (set-face-attribute 'markdown-header-face-4 nil :height s4)
+             (set-face-attribute 'markdown-header-face-5 nil :height s5)
+             (set-face-attribute 'markdown-header-face-6 nil :height s6))))
+
+  (when (and (listp moe-theme-resize-org-title)
+             (not (null moe-theme-resize-org-title))
+             (>= (length moe-theme-resize-org-title) 9))
+    (let* ((s1 (car moe-theme-resize-org-title))
+           (s2 (cadr moe-theme-resize-org-title))
+           (s3 (third moe-theme-resize-org-title))
+           (s4 (fourth moe-theme-resize-org-title))
+           (s5 (fifth moe-theme-resize-org-title))
+           (s6 (sixth moe-theme-resize-org-title))
+           (s7 (seventh moe-theme-resize-org-title))
+           (s8 (eighth moe-theme-resize-org-title))
+           (s9 (ninth moe-theme-resize-org-title)))
+      (progn (require 'org)
+             (set-face-attribute 'org-document-title nil :height s1)
+             (set-face-attribute 'org-level-1 nil :height s2)
+             (set-face-attribute 'org-level-2 nil :height s3)
+             (set-face-attribute 'org-level-3 nil :height s4)
+             (set-face-attribute 'org-level-4 nil :height s5)
+             (set-face-attribute 'org-level-5 nil :height s6)
+             (set-face-attribute 'org-level-6 nil :height s7)
+             (set-face-attribute 'org-level-7 nil :height s8)
+             (set-face-attribute 'org-level-8 nil :height s9))))
+
+  (when (and (listp moe-theme-resize-rst-title)
+             (not (null moe-theme-resize-rst-title))
+             (>= (length moe-theme-resize-rst-title) 6))
+    (let* ((s1 (car moe-theme-resize-rst-title))
+           (s2 (cadr moe-theme-resize-rst-title))
+           (s3 (third moe-theme-resize-rst-title))
+           (s4 (fourth moe-theme-resize-rst-title))
+           (s5 (fifth moe-theme-resize-rst-title))
+           (s6 (sixth moe-theme-resize-rst-title)))
+      (progn (require 'rst)
+             (set-face-attribute 'rst-level-1-face nil :height s1)
+             (set-face-attribute 'rst-level-2-face nil :height s2)
+             (set-face-attribute 'rst-level-3-face nil :height s3)
+             (set-face-attribute 'rst-level-4-face nil :height s4)
+             (set-face-attribute 'rst-level-5-face nil :height s5)
+             (set-face-attribute 'rst-level-6-face nil :height s6)))))
+
+(defun moe-light ()
+  "Load moe-light-theme with your customizations."
+  (interactive)
+  (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"))
+
+  (cond ((eq moe-theme-mode-line-color 'blue) ;要考慮到powerline的顏色搭配...orz
+         (set-face-attribute 'mode-line nil :background "#5fafd7" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#5fafd7" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#5fafd7" 
:background "#3a3a3a"))
+        ((eq moe-theme-mode-line-color 'green)
+         (set-face-attribute 'mode-line nil :background "#a1db00" :foreground 
"#005f00")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#a1db00" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#a1db00" 
:background "#3a3a3a"))
+        ((eq moe-theme-mode-line-color 'orange)
+         (set-face-attribute 'mode-line nil :background "#ff8700" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#ff8700" 
:foreground "#1c1c1c")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#ff8700" 
:background "#1c1c1c"))
+        ((eq moe-theme-mode-line-color 'magenta)
+         (set-face-attribute 'mode-line nil :background "#ff4ea3" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#ff4ea3" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#ff4ea3" 
:background "#3a3a3a"))
+        ((eq moe-theme-mode-line-color 'yellow)
+         (set-face-attribute 'mode-line nil :background "#fce94f" :foreground 
"#875f00")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#fce94f" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#fce94f" 
:background "#3a3a3a"))
+        ((eq moe-theme-mode-line-color 'purple)
+         (set-face-attribute 'mode-line nil :background "#af5fd7" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#af5fd7" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#af5fd7" 
:background "#000000"))
+        ((eq moe-theme-mode-line-color 'red)
+         (set-face-attribute 'mode-line nil :background "#ff4b4b" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#ff4b4b" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#ff4b4b" 
:background "#000000"))
+        ((eq moe-theme-mode-line-color 'cyan)
+         (set-face-attribute 'mode-line nil :background "#5faf87" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#5faf87" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#5faf87" 
:background "#3a3a3a"))
+        ((eq moe-theme-mode-line-color 'w/b)
+         (set-face-attribute 'mode-line nil :background "#8a8a8a" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#8a8a8a" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#8a8a8a" 
:background "#000000")))
+
+  (if (null moe-theme-highlight-buffer-id)
+      (set-face-attribute 'mode-line-buffer-id nil :background nil))
+
+  (if (eq moe-theme-powerline-enable-p t)
+      (powerline-moe-theme)))
+
+(defun moe-dark ()
+  "Load moe-light-theme with your customizations."
+  (interactive)
+  (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")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#5fafd7" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#1f5bff" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'green)
+         (set-face-attribute 'mode-line nil :background "#d7ff5f" :foreground 
"#005f00")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#a1db00" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#5faf00" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'orange)
+         (set-face-attribute 'mode-line nil :background "#ff8700" :foreground 
"#3a3a3a")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#ff8700" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#ff5d17" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'magenta)
+         (set-face-attribute 'mode-line nil :background "#ff4ea3" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#ff4ea3" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#ff1f8b" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'yellow)
+         (set-face-attribute 'mode-line nil :background "#fce94f" :foreground 
"#875f00")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#fce94f" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#875f00" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'purple)
+         (set-face-attribute 'mode-line nil :background "#9a08ff" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#9a08ff" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#6c0099" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'red)
+         (set-face-attribute 'mode-line nil :background "#ff4b4b" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#ff4b4b" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#a40000" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'cyan)
+         (set-face-attribute 'mode-line nil :background "#5faf87" :foreground 
"#ffffff")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#5faf87" 
:foreground "#3a3a3a")
+         (set-face-attribute 'minibuffer-promptnil :foreground "#005f5f" 
:background "#ffffff"))
+        ((eq moe-theme-mode-line-color 'w/b)
+         (set-face-attribute 'mode-line nil :background "#ffffff" :foreground 
"#3a3a3a")
+         (set-face-attribute 'mode-line-buffer-id nil :background "#9e9e9e" 
:foreground "#000000")
+         (set-face-attribute 'minibuffer-prompt nil :foreground "#3e3e3e" 
:background "#ffffff")))
+
+  (if (null moe-theme-highlight-buffer-id)
+      (set-face-attribute 'mode-line-buffer-id nil :background nil))
+
+  (if (eq moe-theme-powerline-enable-p t)
+      (powerline-moe-theme)))
+
+;; Powerline
+
+(defvar moe-theme-powerline-enable-p nil
+  "A variable indicate if `powerline-moe-theme' has been run.
+If you want to use powerline powered by moe-theme, please run
+`powerline-moe-theme', or `moe-theme-select-color' may act
+incorrectly.
+
+Don't setq this manually.")
+
+(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)
+  (setq moe-theme-mode-line-color
+        (intern (completing-read
+                 "Select a color: "
+                 '((blue) (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))
+  (if (eq moe-theme-powerline-enable-p t)
+      (powerline-moe-theme)))
+
+(defun moe-theme-random-color ()
+  "Give me a random mode-line color.=w=+"
+  (interactive)
+  (let* ((n (abs (% (random) 8)))
+         (current-color moe-theme-mode-line-color)
+         (color-list '(blue 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)))
+
+    (if (eq (frame-parameter nil 'background-mode) 'light)
+        (moe-light)
+      (moe-dark))
+    (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'
+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)))
+
+(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 
"#949494" :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 "#000000")
+             (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 "#000000")
+                    (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'
+
+(provide 'moe-theme)
+
 ;; Local Variables:
 ;; coding: utf-8
 ;; End:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]