emacs - commit all stale emacs config
[dotfiles.git] / emacs.d / config / my-powerline.el
1
2
3
4
5 (setq ns-use-srgb-colorspace nil)
6
7 (load-theme 'cyberpunk t)
8
9 ;; Powerline
10 (defun arrow-right-xpm (color1 color2)
11   "Return an XPM right arrow string representing."
12   (format "/* XPM */
13 static char * arrow_right[] = {
14 \"12 18 2 1\",
15 \". c %s\",
16 \"  c %s\",
17 \".           \",
18 \"..          \",
19 \"...         \",
20 \"....        \",
21 \".....       \",
22 \"......      \",
23 \".......     \",
24 \"........    \",
25 \".........   \",
26 \".........   \",
27 \"........    \",
28 \".......     \",
29 \"......      \",
30 \".....       \",
31 \"....        \",
32 \"...         \",
33 \"..          \",
34 \".           \"};"  color1 color2))
35
36 (defun arrow-left-xpm (color1 color2)
37   "Return an XPM right arrow string representing."
38   (format "/* XPM */
39 static char * arrow_right[] = {
40 \"12 18 2 1\",
41 \". c %s\",
42 \"  c %s\",
43 \"           .\",
44 \"          ..\",
45 \"         ...\",
46 \"        ....\",
47 \"       .....\",
48 \"      ......\",
49 \"     .......\",
50 \"    ........\",
51 \"   .........\",
52 \"   .........\",
53 \"    ........\",
54 \"     .......\",
55 \"      ......\",
56 \"       .....\",
57 \"        ....\",
58 \"         ...\",
59 \"          ..\",
60 \"           .\"};"  color2 color1))
61
62 ;;(defconst color1 "#666666") ; gray40
63 ;;(defconst color2 "#999999") ; gray60
64
65 ;;j;(defconst color1 "#4682b4")
66 ;;(defconst color2 "#ff6347")
67
68 (defconst color1 "#6b8e23")
69 (defconst color2 "#eedd82")
70
71 ;;(set-face-attribute 'mode-line-color-2 nil
72 ;;                    :foreground "#171717"
73 ;;                    :bold t
74 ;;                    :background color2)
75
76
77
78 (defvar arrow-right-0 (create-image (arrow-right-xpm "None" color1) 'xpm t :ascent 'center))
79 (defvar arrow-right-1 (create-image (arrow-right-xpm color1 color2) 'xpm t :ascent 'center))
80 (defvar arrow-right-2 (create-image (arrow-right-xpm color2 "None") 'xpm t :ascent 'center))
81 (defvar arrow-left-1  (create-image (arrow-left-xpm color2 color1) 'xpm t :ascent 'center))
82 (defvar arrow-left-2  (create-image (arrow-left-xpm "None" color2) 'xpm t :ascent 'center))
83
84 (display-time)
85
86 (setq-default mode-line-format
87               (list
88                '("-"
89                  mode-line-mule-info
90                  mode-line-modified
91                  minor-mode-alist)
92                '(:eval (concat (propertize " " 'display arrow-right-0)))
93                '(:eval (concat (propertize " %m " 'face 'mode-line-color-1)
94                                (propertize " " 'display arrow-right-1)))
95                '(:eval (concat (propertize " %b " 'face 'mode-line-color-2)
96                                (propertize " " 'display arrow-right-2)))
97                ;; Justify right by filling with spaces to right fringe - 16
98                ;; (16 should be computed rahter than hardcoded)
99                '(:eval (propertize " " 'display '((space :align-to (- right-fringe 17)))))
100                '(:eval (concat (propertize " " 'display arrow-left-2)
101                                (propertize " %p " 'face 'mode-line-color-2)))
102                '(:eval (concat (propertize " " 'display arrow-left-1)
103                                (propertize "%4l:%2c  " 'face 'mode-line-color-1)))
104                  ))
105
106
107 (make-face 'mode-line-color-1)
108 (set-face-attribute 'mode-line-color-1 nil
109                     :foreground "#fffacd"
110                     :bold t
111                     :background color1)
112
113 (make-face 'mode-line-color-2)
114 (set-face-attribute 'mode-line-color-2 nil
115                     :foreground "#fffacd"
116                     :bold t
117                     :background color2)
118
119 (set-face-attribute 'mode-line nil
120                     :foreground "#fffacd"
121                     :background "#171717"
122                     :box nil)
123 (set-face-attribute 'mode-line-inactive nil
124                     :foreground "#fffacd"
125                     :background "#171717")
126
127
128
129 (provide 'my-powerline)