emacs tidy up mode-line, still has one font size padding issue
[dotfiles.git] / emacs.d / config / init-color-theme.el
1
2
3 ;(setq display-time-day-and-date t)
4 ;(display-time-mode t)
5
6
7 (setq ns-use-srgb-colorspace nil)
8
9 (require 'color-theme)
10 ;(load-theme 'tango-dark)
11 ;(require 'moe-theme)
12 ;(moe-dark)
13
14
15 ;(add-to-list 'custom-theme-load-path "~/.emacs.d/el-get/color-theme-tangotango")
16 ;(load-theme 'tangotango t)
17 (load-theme 'cyberpunk t)
18
19 ;(require 'color-theme-sanityinc-tomorrow)
20 ;(color-theme-sanityinc-tomorrow-bright)
21
22
23
24 ;(add-to-list 'load-path "~/.emacs.d/vendor/emacs-powerline")
25 (require 'powerline)
26 ;(powerline-default-theme)
27
28
29 ;(defconst color1 "#6b8e23")
30 ;(defconst color2 "#eedd82")
31
32 ;(make-face 'mode-line-color-1)
33 ;(set-face-attribute 'mode-line-color-1 nil
34 ;                    :foreground "#fffacd"
35 ;                    :bold t
36 ;                    :background color1)
37
38 ;(make-face 'mode-line-color-2)
39 ;(set-face-attribute 'mode-line-color-2 nil
40 ;                    :foreground "#fffacd"
41 ;                    :bold t
42 ;                    :background color2)
43
44
45 ;;(defface powerline-active2 '((t (:background "grey40" :inherit mode-line)))
46 ;;  "Powerline face 2."
47 ;;  :group 'powerline)
48 ;;
49
50
51 ;; https://github.com/howardabrams/dot-files/blob/master/emacs-mode-line.org
52 ;;;(custom-set-faces
53 ;;; '(mode-line-buffer-id ((t (:foreground "#008000" :bold t))))
54 ;;; '(which-func ((t (:foreground "#008000"))))
55 ;;; '(mode-line ((t (:foreground "#008000" :background "#dddddd" :box nil))))
56 ;;; '(mode-line-inactive ((t (:foreground "#008000" :background "#bbbbbb" :box nil)))))
57
58 ;;; this variable should equal as height in mode-line
59 (custom-set-variables
60  '(powerline-text-scale-factor 0.8))
61
62 (custom-set-faces
63  '(mode-line ((t (:foreground "#030303" :background "#bdbdbd" :box nil :height 0.8 ))))
64  '(mode-line-inactive ((t (:foreground "#f9f9f9" :background "#666666" :box nil :height 0.8)))))
65
66
67 (defface powerline-active-yel '((t (:background "yellow" :inherit mode-line)))
68   "Powerline face 1."
69   :group 'powerline)
70
71 (defface powerline-active-blue '((t (:background "blue" :inherit mode-line)))
72   "Powerline face 1."
73   :group 'powerline)
74
75 ;;
76 ;;http://emacser.com/mode-line.htm
77 (defun get-lines-4-mode-line ()
78   (let ((lines (count-lines (point-min) (point-max))))
79     (concat (propertize
80              (format "%d" lines)
81              'mouse-face 'mode-line-highlight
82              'face 'mode-line-lines-face
83              'help-echo (format "%d lines" lines)) " ")))
84
85
86
87 (defun powerline-simpler-vc-mode (s)
88   (if s
89       (replace-regexp-in-string "Git:" "" s)
90     s))
91
92 (defun powerline-simpler-minor-display (s)
93   (replace-regexp-in-string
94    (concat " "
95            (mapconcat 'identity '("Undo-Tree" "GitGutter" "Projectile"
96                                   "Abbrev" "ColorIds" "MRev" "ElDoc" "Paredit"
97                                   "+1" "+2" "FlyC" "Fly" ;; ":1/0"
98                                   "Fill" "AC" "FIC") "\\|")) "" s))
99
100 (defun powerline-ha-theme ()
101   "A powerline theme that removes many minor-modes that don't serve much purpose on the mode-line."
102   (interactive)
103   (setq-default mode-line-format
104                 '("%e"
105                   (:eval
106                    (let*
107                        ((active
108                          (powerline-selected-window-active))
109                         (mode-line
110                          (if active 'mode-line 'mode-line-inactive))
111                         (face1
112                          (if active 'powerline-active1 'powerline-inactive1))
113                         (face2
114                          (if active 'powerline-active2 'powerline-inactive2))
115                         (face3
116                          (if active 'powerline-active-yel 'powerline-inactive2))
117                         (separator-left
118                          (intern
119                           (format "powerline-%s-%s" powerline-default-separator
120                                   (car powerline-default-separator-dir))))
121                         (separator-right
122                          (intern
123                           (format "powerline-%s-%s" powerline-default-separator
124                                   (cdr powerline-default-separator-dir))))
125                         (lhs
126                             (list
127                                 (powerline-raw "%*" nil 'l)
128                                 (powerline-buffer-id nil 'l)
129                                 (powerline-raw " ")
130                                 (funcall separator-left mode-line face1)
131                                 (powerline-narrow face1 'l)
132                                 (powerline-simpler-vc-mode (powerline-vc face1))))
133                         
134                         (rhs
135                             (list
136                                 (funcall separator-right face1 mode-line)
137                                             (powerline-raw (format-time-string " %Y-%m-%d %I:%M %p %a") nil 'r)
138                                 (funcall separator-right mode-line face1)
139                                 (powerline-raw (concat "%3c, %l/" (format "%d" (count-lines (point-min) (point-max)))) face1 'r)
140                                 (funcall separator-right face1 face3)
141                                 (powerline-raw " %4p" face3 'r)))
142                         (center
143                             (list
144                                 (powerline-raw " " face1)
145                                 (funcall separator-left face1 face2)
146                                 (when
147                                     (boundp 'erc-modified-channels-object)
148                                 (powerline-raw erc-modified-channels-object face2 'l))
149                                 (powerline-major-mode face2 'l)
150                                 (powerline-process face2)
151                                 (powerline-raw " :" face2)
152
153                                 (powerline-simpler-minor-display (powerline-minor-modes face2 'l))
154
155                                 (powerline-raw " " face2)
156                                 (funcall separator-right face2 face1))))
157
158
159                      (concat
160                       (powerline-render lhs)
161 ;                      (powerline-fill-center face1
162 ;                                             (/
163 ;                                              (powerline-width center)
164 ;                                              2.0))
165 ;                      (powerline-render center)
166                       (powerline-fill face1
167                                       (powerline-width rhs))
168                       (powerline-render rhs))
169                      ); let
170                    ); :eval
171                   ); '(
172                 ); setq
173   ); defun
174
175
176 (powerline-ha-theme)
177
178
179
180
181 (provide 'init-color-theme)
182
183
184
185 ;                               (powerline-raw mode-line-misc-info face1 'r)
186 ;                                (powerline-raw global-mode-string face1 'r)
187
188 ;;                                          (powerline-raw '(:eval (propertize (format-time-string " %Y-%m-%d %I:%M %p %a")
189 ;;                                                              'help-echo
190 ;;                                                              (concat (format-time-string "%c; ")
191 ;;                                                                      (emacs-uptime "Uptime:%hh")))) nil)