emacs: add new powerline theme according to
authorPeng Li <seudut@gmail.com>
Sat, 16 May 2015 16:11:13 +0000 (00:11 +0800)
committerPeng Li <seudut@gmail.com>
Sat, 16 May 2015 16:11:13 +0000 (00:11 +0800)
https://skalldan.wordpress.com/2012/05/13/emacs-のモードラインを
-powerline-風にカスタマイズ/

emacs.d/config/my-powerline.el [new file with mode: 0644]
emacs.d/init.el

diff --git a/emacs.d/config/my-powerline.el b/emacs.d/config/my-powerline.el
new file mode 100644 (file)
index 0000000..65f849e
--- /dev/null
@@ -0,0 +1,129 @@
+
+
+
+
+(setq ns-use-srgb-colorspace nil)
+
+(load-theme 'cyberpunk t)
+
+;; Powerline
+(defun arrow-right-xpm (color1 color2)
+  "Return an XPM right arrow string representing."
+  (format "/* XPM */
+static char * arrow_right[] = {
+\"12 18 2 1\",
+\". c %s\",
+\"  c %s\",
+\".           \",
+\"..          \",
+\"...         \",
+\"....        \",
+\".....       \",
+\"......      \",
+\".......     \",
+\"........    \",
+\".........   \",
+\".........   \",
+\"........    \",
+\".......     \",
+\"......      \",
+\".....       \",
+\"....        \",
+\"...         \",
+\"..          \",
+\".           \"};"  color1 color2))
+
+(defun arrow-left-xpm (color1 color2)
+  "Return an XPM right arrow string representing."
+  (format "/* XPM */
+static char * arrow_right[] = {
+\"12 18 2 1\",
+\". c %s\",
+\"  c %s\",
+\"           .\",
+\"          ..\",
+\"         ...\",
+\"        ....\",
+\"       .....\",
+\"      ......\",
+\"     .......\",
+\"    ........\",
+\"   .........\",
+\"   .........\",
+\"    ........\",
+\"     .......\",
+\"      ......\",
+\"       .....\",
+\"        ....\",
+\"         ...\",
+\"          ..\",
+\"           .\"};"  color2 color1))
+
+;;(defconst color1 "#666666") ; gray40
+;;(defconst color2 "#999999") ; gray60
+
+;;j;(defconst color1 "#4682b4")
+;;(defconst color2 "#ff6347")
+
+(defconst color1 "#6b8e23")
+(defconst color2 "#eedd82")
+
+;;(set-face-attribute 'mode-line-color-2 nil
+;;                    :foreground "#171717"
+;;                    :bold t
+;;                    :background color2)
+
+
+
+(defvar arrow-right-0 (create-image (arrow-right-xpm "None" color1) 'xpm t :ascent 'center))
+(defvar arrow-right-1 (create-image (arrow-right-xpm color1 color2) 'xpm t :ascent 'center))
+(defvar arrow-right-2 (create-image (arrow-right-xpm color2 "None") 'xpm t :ascent 'center))
+(defvar arrow-left-1  (create-image (arrow-left-xpm color2 color1) 'xpm t :ascent 'center))
+(defvar arrow-left-2  (create-image (arrow-left-xpm "None" color2) 'xpm t :ascent 'center))
+
+(display-time)
+
+(setq-default mode-line-format
+              (list
+               '("-"
+                 mode-line-mule-info
+                 mode-line-modified
+                 minor-mode-alist)
+               '(:eval (concat (propertize " " 'display arrow-right-0)))
+               '(:eval (concat (propertize " %m " 'face 'mode-line-color-1)
+                               (propertize " " 'display arrow-right-1)))
+               '(:eval (concat (propertize " %b " 'face 'mode-line-color-2)
+                               (propertize " " 'display arrow-right-2)))
+               ;; Justify right by filling with spaces to right fringe - 16
+               ;; (16 should be computed rahter than hardcoded)
+               '(:eval (propertize " " 'display '((space :align-to (- right-fringe 17)))))
+               '(:eval (concat (propertize " " 'display arrow-left-2)
+                               (propertize " %p " 'face 'mode-line-color-2)))
+               '(:eval (concat (propertize " " 'display arrow-left-1)
+                               (propertize "%4l:%2c  " 'face 'mode-line-color-1)))
+                 ))
+
+
+(make-face 'mode-line-color-1)
+(set-face-attribute 'mode-line-color-1 nil
+                    :foreground "#fffacd"
+                    :bold t
+                    :background color1)
+
+(make-face 'mode-line-color-2)
+(set-face-attribute 'mode-line-color-2 nil
+                    :foreground "#fffacd"
+                    :bold t
+                    :background color2)
+
+(set-face-attribute 'mode-line nil
+                    :foreground "#fffacd"
+                    :background "#171717"
+                    :box nil)
+(set-face-attribute 'mode-line-inactive nil
+                    :foreground "#fffacd"
+                    :background "#171717")
+
+
+
+(provide 'my-powerline)
index 05f6fc2..386fe2b 100644 (file)
@@ -8,7 +8,6 @@
 ;(add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12:weight:light" ))
 (add-to-list 'default-frame-alist '(font . "Source Code Pro for Powerline-12" ))
 
-(display-time-mode t)
 
 (put 'set-goal-column 'disabled nil)
 (setq vc-follow-symlinks t)
@@ -16,7 +15,7 @@
 (setq ring-bell-function 'ignore)
 (setq resize-mini-windows t)
 
-(setq ns-use-srgb-colorspace nil)
+
 (add-to-list 'auto-mode-alist '("emacs\\'" . emacs-lisp-mode))
 (fringe-mode 0)
 
 ;; 
 (add-to-list 'load-path "~/.emacs.d/config")
 (require 'init-color-theme)
+;(require 'my-powerline)
+;(require 'init-my-theme-2)
+
+
 
 
+(toggle-frame-fullscreen)