You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

784 lines
40 KiB

5 years ago
6 years ago
6 years ago
4 years ago
6 years ago
6 years ago
5 years ago
5 years ago
6 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
5 years ago
6 years ago
6 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
4 years ago
6 years ago
6 years ago
  1. ;;; zerodark-theme.el --- A dark, medium contrast theme for Emacs -*- lexical-binding: t -*-
  2. ;; Copyright (C) 2015-2016 Nicolas Petton
  3. ;; Author: Nicolas Petton <nicolas@petton.fr>
  4. ;; Keywords: themes
  5. ;; URL: https://github.com/NicolasPetton/zerodark-theme
  6. ;; Version: 4.3
  7. ;; Package: zerodark-theme
  8. ;; Package-Requires: ((all-the-icons "2.0.0") (magit "2.8.0") (flycheck "29"))
  9. ;; This file is NOT part of GNU Emacs
  10. ;;; License:
  11. ;;
  12. ;; Zerodark (https://github.com/zerodark-theme) is licensed under a
  13. ;; Creative Commons Attribution-ShareAlike 4.0 International License.
  14. ;;; Commentary:
  15. ;;
  16. ;; A dark theme inspired from One Dark and Niflheim.
  17. ;;
  18. ;; An optional mode-line format can be enabled with
  19. ;; `zerodark-setup-modeline-format'.
  20. ;;
  21. ;;; Code:
  22. (require 'all-the-icons)
  23. (defmacro cached-for (secs &rest body)
  24. "Cache for SECS the result of the evaluation of BODY."
  25. (declare (debug t))
  26. (let ((cache (make-symbol "cache"))
  27. (last-run (make-symbol "last-run")))
  28. `(let (,cache ,last-run)
  29. (lambda ()
  30. (when (or (null ,last-run)
  31. (> (- (time-to-seconds (current-time)) ,last-run)
  32. ,secs))
  33. (setf ,cache (progn ,@body))
  34. (setf ,last-run (time-to-seconds (current-time))))
  35. ,cache))))
  36. (deftheme zerodark
  37. "A dark medium contrast theme")
  38. (defgroup zerodark
  39. nil
  40. "A dark theme inspired from One Dark and Niflheim.")
  41. (defcustom zerodark-use-paddings-in-mode-line t
  42. "When non-nil, use top and bottom paddings in the mode-line."
  43. :type 'boolean
  44. :group 'zerodark)
  45. (defface zerodark-ro-face
  46. '((t :foreground "#0088CC" :weight bold))
  47. "Face for read-only buffer in the mode-line.")
  48. (defface zerodark-modified-face
  49. '((t :foreground "#ff6c6b" :height 0.9))
  50. "Face for modified buffers in the mode-line.")
  51. (defface zerodark-not-modified-face
  52. '((t :foreground "#98be65" :height 0.9))
  53. "Face for not modified buffers in the mode-line.")
  54. (defface zerodark-buffer-position-face
  55. '((t :height 0.9))
  56. "Face for line/column numbers in the mode-line.")
  57. (defface zerodark-vc-face
  58. '((t :foreground "#61afef"))
  59. "Face for vc status in the mode-line.")
  60. (defface zerodark-ok-face
  61. '((t :foreground "#61afef"))
  62. "Face for ok status in the mode-line.")
  63. (defface zerodark-warning-face
  64. '((t :foreground "#da8548"))
  65. "Face for warning status in the mode-line.")
  66. (defface zerodark-error-face
  67. '((t :foreground "#ff6c6b"))
  68. "Face for error status in the mode-line.")
  69. (defvar zerodark-modeline-position '(:eval (propertize ":%l:%c %p " 'face (if (zerodark--active-window-p)
  70. 'zerodark-buffer-position-face
  71. 'mode-line-inactive)))
  72. "Mode line construct for displaying the position in the buffer.")
  73. (defvar zerodark-modeline-buffer-identification '(:eval (propertize "%b" 'face 'bold))
  74. "Mode line construct for displaying the position in the buffer.")
  75. (defvar zerodark-modeline-modified '(:eval (if (buffer-modified-p (current-buffer))
  76. (all-the-icons-faicon "floppy-o"
  77. :height 0.9
  78. :v-adjust 0
  79. :face (if (zerodark--active-window-p)
  80. 'zerodark-modified-face
  81. 'mode-line-inactive))
  82. (all-the-icons-faicon "check"
  83. :height 0.9
  84. :v-adjust 0
  85. :face (if (zerodark--active-window-p)
  86. 'zerodark-not-modified-face
  87. 'mode-line-inactive)))))
  88. (defvar zerodark-modeline-ro '(:eval (if buffer-read-only
  89. (if (zerodark--active-window-p)
  90. (progn
  91. (propertize "RO " 'face 'zerodark-ro-face))
  92. (propertize "RO " 'face 'bold))
  93. "")))
  94. (defvar zerodark-buffer-coding '(:eval (unless (eq buffer-file-coding-system (default-value 'buffer-file-coding-system))
  95. mode-line-mule-info)))
  96. (defvar zerodark-modeline-vc '(vc-mode (" "
  97. (:eval (all-the-icons-faicon "code-fork"
  98. :height 0.9
  99. :v-adjust 0
  100. :face (when (zerodark--active-window-p)
  101. (zerodark-git-face))))
  102. (:eval (propertize (truncate-string-to-width vc-mode 25 nil nil "...")
  103. 'face (when (zerodark--active-window-p)
  104. (zerodark-git-face)))))))
  105. (defun zerodark-modeline-flycheck-status ()
  106. "Return the status of flycheck to be displayed in the mode-line."
  107. (when flycheck-mode
  108. (let* ((text (pcase flycheck-last-status-change
  109. (`finished (if flycheck-current-errors
  110. (let ((count (let-alist (flycheck-count-errors flycheck-current-errors)
  111. (+ (or .warning 0) (or .error 0)))))
  112. (propertize (format "✖ %s Issue%s" count (if (eq 1 count) "" "s"))
  113. 'face (zerodark-face-when-active 'zerodark-error-face)))
  114. (propertize "✔ No Issues"
  115. 'face (zerodark-face-when-active 'zerodark-ok-face))))
  116. (`running (propertize "⟲ Running"
  117. 'face (zerodark-face-when-active 'zerodark-warning-face)))
  118. (`no-checker (propertize "⚠ No Checker"
  119. 'face (zerodark-face-when-active 'zerodark-warning-face)))
  120. (`not-checked "✖ Disabled")
  121. (`errored (propertize "⚠ Error"
  122. 'face (zerodark-face-when-active 'zerodark-error-face)))
  123. (`interrupted (propertize "⛔ Interrupted"
  124. 'face (zerodark-face-when-active 'zerodark-error-face)))
  125. (`suspicious ""))))
  126. (propertize text
  127. 'help-echo "Show Flycheck Errors"
  128. 'local-map (make-mode-line-mouse-map
  129. 'mouse-1 #'flycheck-list-errors)))))
  130. (defun true-color-p ()
  131. "Return non-nil on displays that support 256 colors."
  132. (or
  133. (display-graphic-p)
  134. (= (tty-display-color-cells) 16777216)))
  135. (defvar zerodark--git-face-cached (cached-for 1 (zerodark--git-face-intern)))
  136. (defun zerodark--git-face-intern ()
  137. "Return the face to use based on the current repository status."
  138. (if (magit-git-success "diff" "--quiet")
  139. ;; nothing to commit because nothing changed
  140. (if (zerop (length (magit-git-string
  141. "rev-list" (concat "origin/"
  142. (magit-get-current-branch)
  143. ".."
  144. (magit-get-current-branch)))))
  145. ;; nothing to push as well
  146. 'zerodark-ok-face
  147. ;; nothing to commit, but some commits must be pushed
  148. 'zerodark-warning-face)
  149. 'zerodark-error-face))
  150. (defun zerodark-git-face ()
  151. "Return the face to use based on the current repository status.
  152. The result is cached for one second to avoid hiccups."
  153. (funcall zerodark--git-face-cached))
  154. (let ((class '((class color) (min-colors 89)))
  155. (default (if (true-color-p) "#abb2bf" "#afafaf"))
  156. (light (if (true-color-p) "#ccd4e3" "#d7d7d7"))
  157. (background (if (true-color-p) "#282c34" "#333333"))
  158. (background-dark (if (true-color-p) "#24282f" "#222222"))
  159. (background-darker (if (true-color-p) "#22252c" "#222222"))
  160. (mode-line-inactive (if "#1c2129" "#222222"))
  161. (mode-line-active (if (true-color-p) "#6f337e" "#875f87"))
  162. (background-lighter (if (true-color-p) "#3a3f4b" "#5f5f5f"))
  163. (background-red (if (true-color-p) "#4c3840" "#5f5f5f"))
  164. (bright-background-red (if (true-color-p) "#744a5b" "#744a5b"))
  165. (background-purple (if (true-color-p) "#48384c" "#5f5f5f"))
  166. (background-blue (if (true-color-p) "#38394c" "#444444"))
  167. (bright-background-blue (if (true-color-p) "#4e5079" "#4e5079"))
  168. (background-green (if (true-color-p) "#3d4a41" "#5f5f5f"))
  169. (bright-background-green (if (true-color-p) "#3f6d54" "#3f6d54"))
  170. (background-orange (if (true-color-p) "#4a473d" "#5f5f5f"))
  171. (hl-line (if (true-color-p) "#2c323b" "#333333"))
  172. (grey (if (true-color-p) "#cccccc" "#cccccc"))
  173. (grey-dark (if (true-color-p) "#666666" "#666666"))
  174. (highlight (if (true-color-p) "#3e4451" "#5f5f5f"))
  175. (comment (if (true-color-p) "#687080" "#707070"))
  176. (orange (if (true-color-p) "#da8548" "#d7875f"))
  177. (orange-light (if (true-color-p) "#ddbd78" "#d7af87"))
  178. (red (if (true-color-p) "#ff6c6b" "#ff5f5f"))
  179. (purple (if (true-color-p) "#c678dd" "#d787d7"))
  180. (purple-dark (if (true-color-p) "#64446d" "#5f5f5f"))
  181. (blue (if (true-color-p) "#61afef" "#5fafff"))
  182. (blue-dark (if (true-color-p) "#1f5582" "#005f87"))
  183. (green (if (true-color-p) "#98be65" "#87af5f"))
  184. (green-light (if (true-color-p) "#9eac8c" "#afaf87"))
  185. (peach "PeachPuff3")
  186. (diff-added-background (if (true-color-p) "#284437" "#284437"))
  187. (diff-added-refined-background (if (true-color-p) "#1e8967" "#1e8967"))
  188. (diff-removed-background (if (true-color-p) "#583333" "#580000"))
  189. (diff-removed-refined-background (if (true-color-p) "#b33c49" "#b33c49"))
  190. (diff-current-background (if (true-color-p) "#29457b" "#29457b"))
  191. (diff-current-refined-background (if (true-color-p) "#4174ae" "#4174ae")))
  192. (custom-theme-set-faces
  193. 'zerodark
  194. `(default ((,class (:background ,background :foreground ,default))))
  195. `(cursor ((,class (:background ,default))))
  196. ;; Highlighting faces
  197. `(fringe ((,class (:background ,background-dark :foreground ,comment))))
  198. `(border ((,class (:foreground ,background-lighter))))
  199. `(vertical-border ((,class (:foreground ,background-lighter))))
  200. `(highlight ((,class (:background ,highlight :foreground ,default :underline nil))))
  201. `(region ((,class (:background ,highlight :foreground ,default))))
  202. `(secondary-selection ((,class (:background ,highlight :foreground ,default))))
  203. `(isearch ((,class (:background ,orange-light :foreground ,highlight))))
  204. `(lazy-highlight ((,class (:background ,grey-dark :foreground ,orange-light))))
  205. `(hl-line ((,class (:background ,hl-line :underline unspecified :inherit nil))))
  206. `(match ((,class (:background ,background-green))))
  207. ;; Font lock faces
  208. `(font-lock-builtin-face ((,class (:foreground ,blue :weight bold))))
  209. `(font-lock-comment-face ((,class (:foreground ,comment :slant italic))))
  210. `(font-lock-constant-face ((,class (:foreground ,orange :weight bold))))
  211. `(font-lock-function-name-face ((,class (:foreground ,blue))))
  212. `(font-lock-keyword-face ((,class (:foreground ,purple :weight bold))))
  213. `(font-lock-string-face ((,class (:foreground ,green))))
  214. `(font-lock-doc-face ((,class (:foreground ,green-light))))
  215. `(font-lock-type-face ((,class (:foreground ,blue))))
  216. `(font-lock-variable-name-face ((,class (:foreground ,blue))))
  217. `(font-lock-warning-face ((,class (:foreground ,red :weight bold :background ,background-red))))
  218. ;; Mode line faces
  219. `(mode-line ((,class (:background ,background-blue :height 0.9 :foreground ,blue
  220. :box ,(when zerodark-use-paddings-in-mode-line
  221. (list :line-width 6 :color background-blue))))))
  222. `(mode-line-inactive ((,class (:background ,background-darker :height 0.9 :foreground ,default
  223. :box ,(when zerodark-use-paddings-in-mode-line
  224. (list :line-width 6 :color background-darker))))))
  225. `(header-line ((,class (:inherit mode-line-inactive))))
  226. ;; error & success
  227. `(error ((,class (:foreground ,red :weight bold))))
  228. `(warning ((,class (:foreground ,orange :weight bold))))
  229. `(success ((,class (:foreground ,green :weight bold))))
  230. ;; powerline
  231. `(powerline-active1 ((,class (:height 0.9 :foreground ,blue :background ,background-darker))))
  232. `(powerline-active2 ((,class (:height 0.9 :foreground ,blue :background ,background-lighter))))
  233. ;; mml
  234. `(message-mml-face ((,class (:foreground ,comment))))
  235. ;; Org-clock mode line
  236. `(org-mode-line-clock ((,class (:background unspecified (:inherit mode-line)))))
  237. ;; Escape and prompt faces
  238. `(minibuffer-prompt ((,class (:foreground ,blue :weight bold))))
  239. `(escape-glyph ((,class (:foreground ,blue :weight bold))))
  240. ;; linum
  241. `(linum ((,class (:foreground ,comment :background ,background))))
  242. ;; from hlinum
  243. `(linum-highlight-face ((,class (:foreground ,blue ,background ,background-blue))))
  244. ;; eshell
  245. `(eshell-prompt ((,class (:foreground ,orange :background ,background :weight bold))))
  246. `(eshell-ls-directory ((,class (:foreground ,purple :background ,background :weight bold))))
  247. `(eshell-ls-symlink ((,class (:foreground ,orange :background ,background :weight normal))))
  248. `(eshell-ls-executable ((,class (:foreground ,green :background ,background :weight bold))))
  249. ;; whitespace
  250. `(whitespace-space ((,class (:background unspecified :foreground ,highlight
  251. :inverse-video unspecified))))
  252. `(whitespace-hspace ((,class (:background unspecified :foreground ,highlight
  253. :inverse-video unspecified))))
  254. `(whitespace-tab ((,class (:background unspecified :foreground ,highlight
  255. :inverse-video unspecified))))
  256. `(whitespace-newline ((,class (:background unspecified :foreground ,highlight
  257. :inverse-video unspecified))))
  258. `(whitespace-trailing ((,class (:background ,red :foreground ,background :weight bold
  259. :inverse-video nil))))
  260. `(whitespace-line ((,class (:background unspecified :foreground ,red
  261. :inverse-video unspecified))))
  262. `(whitespace-space-before-tab ((,class (:inherit whitespace-space))))
  263. `(whitespace-space-after-tab ((,class (:inherit whitespace-space))))
  264. `(whitespace-indentation ((,class (:background unspecified :foreground ,highlight
  265. :inverse-video unspecified))))
  266. `(whitespace-empty ((,class (:background ,orange :foreground ,highlight
  267. :inverse-video unspecified))))
  268. ;; link faces
  269. `(link ((,class (:foreground ,blue :underline t))))
  270. `(link-visited ((,class (:foreground ,blue :underline t))))
  271. ;; widget faces
  272. `(widget-field ((,class (:background ,highlight :box (:line-width 1 :color ,comment)))))
  273. `(widget-button ((,class (:inherit link))))
  274. ;; custom
  275. `(custom-button ((,class (:background ,background-lighter :box (:line-width 2 :style released-button)))))
  276. `(custom-button-mouse ((,class (:background ,highlight :box (:line-width 2 :style released-button)))))
  277. `(custom-button-pressed ((,class (:background ,highlight :box (:line-width 2 :style pressed-button)))))
  278. `(custom-group-tag ((,class (:foreground ,purple :weight bold :height 1.4))))
  279. `(custom-variable-tag ((,class (:foreground ,purple :weight bold))))
  280. `(custom-state ((,class (:foreground ,green))))
  281. ;; compilation
  282. `(compilation-info ((,class (:foreground ,purple :weight bold))))
  283. `(compilation-warning ((,class (:foreground ,orange :weight bold))))
  284. `(compilation-error ((,class (:foreground ,red :weight bold))))
  285. `(compilation-line-number ((,class (:foreground ,green :weight bold))))
  286. `(compilation-mode-line-exit ((,class (:foreground ,green :weight bold :inverse-video nil))))
  287. `(compilation-mode-line-run ((,class (:foreground ,orange :weight bold))))
  288. `(compilation-mode-line-fail ((,class (:foreground ,red :weight bold))))
  289. ;; dired
  290. `(dired-header ((,class (:foreground ,blue :background ,background-blue :weight bold))))
  291. `(dired-directory ((,class (:foreground ,purple :weight bold))))
  292. ;; diff
  293. `(diff-removed ((,class (:background ,background-red :foreground ,red))))
  294. `(diff-added ((,class (:background ,background-green :foreground ,green))))
  295. `(diff-hunk-header ((,class (:background ,background-blue :weight bold :foreground ,blue))))
  296. `(diff-file-header ((,class (:weight bold))))
  297. `(diff-header ((,class (:background ,background :foreground ,blue))))
  298. `(diff-context ((,class (:foreground ,default))))
  299. `(diff-refine-added ((,class (:foreground ,green :background ,bright-background-green))))
  300. `(diff-refine-removed ((,class (:background ,bright-background-red :foreground ,red))))
  301. ;; ediff
  302. `(ediff-fine-diff-B ((,class (:inherit diff-refine-added))))
  303. `(ediff-current-diff-B ((,class (:inherit diff-added))))
  304. `(ediff-fine-diff-A ((,class (:inherit diff-refine-removed))))
  305. `(ediff-current-diff-A ((,class (:inherit diff-removed))))
  306. `(ediff-fine-diff-C ((,class (:foreground ,blue :background ,bright-background-blue))))
  307. `(ediff-current-diff-C ((,class (:background ,background-blue :foreground ,blue))))
  308. ;; magit
  309. `(magit-diff-context-highlight ((,class (:background ,background-darker))))
  310. `(magit-diff-file-heading ((,class (:weight bold :foreground ,blue))))
  311. `(magit-diff-file-heading-highlight ((,class (:weight bold :foreground ,blue :background ,background-blue))))
  312. `(magit-diff-removed-highlight ((,class (:inherit diff-removed))))
  313. `(magit-diff-removed ((,class (:inherit diff-removed))))
  314. `(magit-diff-added-highlight ((,class (:inherit diff-added))))
  315. `(magit-diff-added ((,class (:inherit diff-added))))
  316. `(magit-diff-lines-heading ((,class (:background ,blue-dark :foreground "white"))))
  317. `(magit-diff-hunk-heading ((,class (:background ,background-lighter))))
  318. `(magit-diff-hunk-heading-highlight ((,class (:background ,blue-dark))))
  319. `(magit-diff-hunk-heading ((,class (:background ,background-lighter))))
  320. `(magit-process-ok ((,class (:foreground ,green :weight bold))))
  321. `(magit-section-highlight ((,class (:background ,background-darker))))
  322. `(magit-section-heading ((,class (:foreground ,grey :weight bold))))
  323. `(magit-branch-current ((,class (:foreground ,blue :background ,background-darker :box 1))))
  324. `(magit-branch-local ((,class (:foreground ,purple :background ,background-darker :box 1))))
  325. `(magit-branch-remote ((,class (:foreground ,green :background ,background-darker :box 1))))
  326. `(magit-reflog-reset ((,class (:background ,background-red :foreground ,red :weight bold))))
  327. `(magit-reflog-amend ((,class (:background ,background-blue :foreground ,blue :weight bold))))
  328. `(magit-reflog-rebase ((,class (:background ,background-blue :foreground ,blue :weight bold))))
  329. `(magit-reflog-commit ((,class (:background ,background-green :foreground ,green :weight bold))))
  330. `(magit-reflog-checkout ((,class (:background ,background-orange :foreground ,orange :weight bold))))
  331. `(magit-reflog-cherry-pick ((,class (:background ,background-purple :foreground ,purple :weight bold))))
  332. `(magit-bisect-bad ((,class (:background ,background-red :foreground ,red :box 1))))
  333. `(magit-bisect-good ((,class (:background ,background-blue :foreground ,blue :box 1))))
  334. `(magit-blame-heading ((,class (:foreground ,green :background ,background-green :box 1))))
  335. `(git-commit-summary ((,class (:weight bold))))
  336. `(magit-tag ((,class (:foreground ,purple :weight bold :box 1 :background "#202020"))))
  337. `(magit-sequence-part ((,class (:foreground ,orange :weight bold))))
  338. `(magit-sequence-head ((,class (:foreground ,green :weight bold))))
  339. ;; Message faces
  340. `(message-header-name ((,class (:foreground ,blue :weight bold))))
  341. `(message-header-cc ((,class (:foreground ,purple))))
  342. `(message-header-other ((,class (:foreground ,purple))))
  343. `(message-header-subject ((,class (:foreground ,green))))
  344. `(message-header-to ((,class (:foreground ,purple))))
  345. `(message-cited-text ((,class (:foreground ,comment))))
  346. `(message-separator ((,class (:foreground ,red :weight bold))))
  347. ;; ido faces
  348. `(ido-first-match ((,class (:foreground ,purple :weight bold))))
  349. `(ido-only-match ((,class (:foreground ,purple :weight bold))))
  350. `(ido-subdir ((,class (:foreground ,blue))))
  351. ;; notmuch
  352. `(notmuch-message-summary-face ((,class (:background ,highlight :box (:line-width 2 :color ,background)))))
  353. `(notmuch-search-count ((,class (:foreground ,red :weight bold))))
  354. `(notmuch-search-matching-authors ((,class (:foreground ,comment))))
  355. `(notmuch-search-subject ((,class (:foreground ,default))))
  356. `(notmuch-search-unread-face ((,class (:weight bold))))
  357. `(notmuch-search-date ((,class (:foreground ,purple))))
  358. `(notmuch-crypto-part-header ((,class (:foreground ,blue))))
  359. `(notmuch-crypto-decryption ((,class (:foreground ,purple))))
  360. `(notmuch-crypto-signature-unknown ((,class (:foreground ,red))))
  361. `(notmuch-crypto-signature-good ((,class (:background ,blue :foreground ,background :weight bold))))
  362. `(notmuch-crypto-signature-good-key ((,class (:background ,blue :foreground ,background :weight bold))))
  363. `(notmuch-crypto-signature-bad ((,class (:background ,red :foreground ,background :weight bold))))
  364. `(notmuch-tag-face ((,class (:foreground ,green :weight bold))))
  365. `(notmuch-tree-match-author-face ((,class (:foreground ,purple))))
  366. `(notmuch-tree-match-tag-face ((,class (:foreground ,green :weight bold))))
  367. ;; company
  368. `(company-preview ((,class (:background ,background-darker :foreground ,default))))
  369. `(company-preview-common ((,class (:background ,background-darker :foreground ,purple))))
  370. `(company-preview-search ((,class (:background ,blue :foreground ,default))))
  371. `(company-tooltip ((,class (:background ,background-darker :foreground ,default))))
  372. `(company-scrollbar-bg ((,class (:background ,background-darker))))
  373. `(company-scrollbar-fg ((,class (:background ,background-blue))))
  374. `(company-tooltip-common ((,class (:foreground ,purple :weight bold :background ,background-darker))))
  375. `(company-tooltip-annotation ((,class (:foreground ,blue :weight bold :background ,background-blue))))
  376. `(company-tooltip-common-selection ((,class (:foreground ,purple :background ,background-lighter :weight bold))))
  377. `(company-tooltip-selection ((,class (:foreground ,default :background ,background-lighter))))
  378. `(company-tooltip-mouse ((,class (:foreground ,default :background ,background-lighter))))
  379. ;; web-mode
  380. `(web-mode-html-tag-face ((,class (:foreground ,purple :weight bold))))
  381. `(web-mode-symbol-face ((,class (:foreground ,red :weight bold))))
  382. ;; js2-mode
  383. `(js2-function-param ((,class (:foreground ,blue))))
  384. `(js2-error ((,class (:foreground ,red))))
  385. `(js2-jsdoc-html-tag-name ((,class (:foreground ,peach))))
  386. `(js2-jsdoc-html-tag-delimiter ((,class (:foreground ,peach))))
  387. ;; flycheck
  388. `(flycheck-fringe-error ((,class (:foreground ,red :background ,background-red :weight bold :inverse-video t))))
  389. `(flycheck-fringe-warning ((,class (:background ,background-orange :foreground ,orange :weight bold :inverse-video t))))
  390. `(flycheck-fringe-info ((,class (:background ,background-blue :foreground ,blue :weight bold :inverse-video t))))
  391. `(flycheck-warning ((,class (:underline (:color ,red :style wave)))))
  392. `(flycheck-error ((,class (:underline (:color ,red :style wave)))))
  393. ;; FIC
  394. `(font-lock-fic-face ((,class (:foreground ,background :background ,red :weight bold))))
  395. ;; org-mode todo
  396. `(org-hide ((,class (:foreground ,background))))
  397. `(org-todo ((,class (:foreground ,red :background ,background-red :weight bold))))
  398. `(org-done ((,class (:foreground ,blue :background ,background-blue :weight bold))))
  399. `(org-date ((,class (:background ,background-lighter))))
  400. `(org-scheduled-previously ((,class (:foreground ,red))))
  401. `(org-scheduled ((,class (:foreground ,default))))
  402. `(org-upcoming-deadline ((,class (:foreground ,orange))))
  403. `(org-headline-done ((,class (:foreground ,comment))))
  404. `(outline-1 ((,class (:foreground ,blue :weight bold))))
  405. `(outline-2 ((,class (:foreground ,purple :weight bold))))
  406. `(outline-3 ((,class (:foreground ,peach :weight bold))))
  407. `(outline-4 ((,class (:foreground ,green-light :weight bold))))
  408. `(outline-5 ((,class (:foreground ,blue :weight bold))))
  409. `(outline-6 ((,class (:foreground ,purple :weight bold))))
  410. `(outline-7 ((,class (:foreground ,peach :weight bold))))
  411. `(outline-8 ((,class (:foreground ,green-light :weight bold))))
  412. `(org-column-title ((,class (:foreground unspecified :background unspecified))))
  413. `(org-agenda-date ((,class (:foreground ,purple :weight bold))))
  414. `(org-agenda-date-today ((,class (:foreground ,blue :weight bold :background ,background-blue :box 1))))
  415. `(org-agenda-structure ((,class (:foreground ,blue :weight bold))))
  416. `(org-scheduled-today ((,class (:foreground ,default :weight bold))))
  417. `(org-agenda-done ((,class (:foreground ,comment))))
  418. `(org-time-grid ((,class (:foreground ,comment))))
  419. ;; org columns
  420. `(org-column ((,class (:background ,background-darker))))
  421. `(org-column-title ((,class (:background ,background-blue :foreground ,blue :weight bold))))
  422. ;; org blocks
  423. `(org-block-begin-line ((,class (:background ,background-green :foreground ,green-light :height 0.9))))
  424. `(org-block-end-line ((,class (:background ,background-green :foreground ,green-light :height 0.9))))
  425. ;; Gnus faces -- from wombat, feel free to improve :)
  426. `(gnus-group-news-1 ((,class (:weight bold :foreground "#95e454"))))
  427. `(gnus-group-news-1-low ((,class (:foreground "#95e454"))))
  428. `(gnus-group-news-2 ((,class (:weight bold :foreground "#cae682"))))
  429. `(gnus-group-news-2-low ((,class (:foreground "#cae682"))))
  430. `(gnus-group-news-3 ((,class (:weight bold :foreground "#ccaa8f"))))
  431. `(gnus-group-news-3-low ((,class (:foreground "#ccaa8f"))))
  432. `(gnus-group-news-4 ((,class (:weight bold :foreground "#99968b"))))
  433. `(gnus-group-news-4-low ((,class (:foreground "#99968b"))))
  434. `(gnus-group-news-5 ((,class (:weight bold :foreground "#cae682"))))
  435. `(gnus-group-news-5-low ((,class (:foreground "#cae682"))))
  436. `(gnus-group-news-low ((,class (:foreground "#99968b"))))
  437. `(gnus-group-mail-1 ((,class (:weight bold :foreground "#95e454"))))
  438. `(gnus-group-mail-1-low ((,class (:foreground "#95e454"))))
  439. `(gnus-group-mail-2 ((,class (:weight bold :foreground "#cae682"))))
  440. `(gnus-group-mail-2-low ((,class (:foreground "#cae682"))))
  441. `(gnus-group-mail-3 ((,class (:weight bold :foreground "#ccaa8f"))))
  442. `(gnus-group-mail-3-low ((,class (:foreground "#ccaa8f"))))
  443. `(gnus-group-mail-low ((,class (:foreground "#99968b"))))
  444. `(gnus-header-content ((,class (:foreground "#8ac6f2"))))
  445. `(gnus-header-from ((,class (:weight bold :foreground "#95e454"))))
  446. `(gnus-header-subject ((,class (:foreground "#cae682"))))
  447. `(gnus-header-name ((,class (:foreground "#8ac6f2"))))
  448. `(gnus-header-newsgroups ((,class (:foreground "#cae682"))))
  449. ;; which-function
  450. `(which-func ((,class (:foreground ,purple))))
  451. `(ediff-even-diff-A ((,class (:background ,highlight :foreground unspecified))))
  452. `(ediff-even-diff-B ((,class (:background ,highlight :foreground unspecified))))
  453. `(ediff-even-diff-C ((,class (:background ,highlight :foreground unspecified))))
  454. `(ediff-odd-diff-A ((,class (:background ,highlight :foreground unspecified))))
  455. `(ediff-odd-diff-B ((,class (:background ,highlight :foreground unspecified))))
  456. `(ediff-odd-diff-C ((,class (:background ,highlight :foreground unspecified))))
  457. ;; ivy
  458. `(ivy-current-match ((,class (:background ,background-purple :weight bold :foreground ,purple))))
  459. `(ivy-minibuffer-match-face-1 ((,class (:foreground ,orange))))
  460. `(ivy-minibuffer-match-face-2 ((,class (:foreground ,green))))
  461. `(ivy-minibuffer-match-face-3 ((,class (:foreground ,orange))))
  462. `(ivy-minibuffer-match-face-4 ((,class (:foreground ,green))))
  463. `(ivy-match-required-face ((,class (:foreground ,red :background ,background-red :weight bold))))
  464. `(ivy-modified-buffer ((,class (:foreground ,red))))
  465. `(ivy-remote ((,class (:foreground ,blue))))
  466. ;; helm
  467. `(helm-candidate-number ((,class (:weight bold))))
  468. `(helm-header-line-left-margin ((,class (:weight bold :foreground ,red))))
  469. `(helm-source-header ((,class (:height 1.2 :weight bold :foreground ,blue :background ,background-blue))))
  470. `(helm-selection ((,class (:background ,background-lighter))))
  471. `(helm-match ((,class (:foreground ,purple :background ,background-purple :weight bold))))
  472. `(helm-match-item ((,class (:inherit isearch))))
  473. `(helm-M-x-key ((,class (:foreground ,blue :weight bold :background ,background-blue))))
  474. `(helm-visible-mark ((,class (:weight bold :foreground ,orange :background ,background-darker))))
  475. `(helm-prefarg ((,class (:weight bold :foreground ,red :background ,background-red))))
  476. `(helm-separator ((,class (:weight bold :foreground , blue))))
  477. `(helm-grep-file ((,class ())))
  478. `(helm-grep-finish ((,class (:foreground ,green))))
  479. `(helm-grep-running ((,class (:foreground ,red))))
  480. `(helm-grep-lineno ((,class (:foreground ,blue))))
  481. `(helm-grep-match ((,class (:foreground ,purple :background ,background-purple :weight bold))))
  482. `(helm-moccur-buffer ((,class ())))
  483. `(helm-buffer-directory ((,class (:foreground ,purple))))
  484. `(helm-buffer-file ((,class ())))
  485. `(helm-buffer-process ((,class (:foreground ,purple))))
  486. `(helm-buffer-size ((,class (:foreground ,blue))))
  487. `(helm-buffer-saved-out ((,class (:foreground ,red :weight bold))))
  488. `(helm-ff-directory ((,class (:foreground ,purple))))
  489. `(helm-ff-dotted-directory ((,class (:foreground ,purple))))
  490. `(helm-ff-prefix ((,class (:weight bold :foreground ,red))))
  491. `(helm-ff-file ((,class ())))
  492. `(helm-ff-executable ((,class (:foreground ,green :weight bold :background ,background-green))))
  493. `(helm-ff-symlink ((,class (:foreground ,orange))))
  494. `(helm-ff-invalid-symlink ((,class (:foreground ,red :weight bold :background ,background-red))))
  495. `(helm-history-deleted ((,class (:foreground ,red :weight bold :background ,background-red))))
  496. ;; visible mark
  497. `(visible-mark-face1 ((,class (:foreground ,orange-light :inverse-video t))))
  498. `(visible-mark-face2 ((,class (:foreground ,peach :inverse-video t))))
  499. ;; show-paren
  500. `(show-paren-match ((,class (:background ,blue-dark))))
  501. ;; clojure
  502. `(clojure-keyword-face ((,class (:inherit font-lock-builtin-face))))
  503. ;; ledger
  504. `(ledger-font-report-clickable-face ((,class (:foreground ,blue))))
  505. `(ledger-font-posting-amount-face ((,class (:foreground ,purple))))
  506. `(ledger-font-posting-date-face ((,class (:foreground ,blue :background ,background-blue :box 1))))
  507. `(ledger-font-payee-uncleared-face ((,class (:foreground ,default :weight bold))))
  508. `(ledger-font-payee-cleared-face ((,class (:foreground ,green :weight bold))))
  509. `(ledger-font-posting-account-face ((,class (:foreground ,default))))
  510. `(ledger-font-posting-account-pending-face ((,class (:foreground ,red))))
  511. `(ledger-font-xact-highlight-face ((,class (:background ,background-darker))))
  512. `(ledger-font-other-face ((,class (:inherit ,font-lock-comment-face))))
  513. `(ledger-font-periodic-xact-face ((,class (:foreground ,orange))))
  514. `(diff-hl-change ((,class (:foreground ,purple :background ,background-purple))))
  515. `(diff-hl-delete ((,class (:foreground ,red :background ,background-red))))
  516. `(diff-hl-insert ((,class (:foreground ,green :background ,background-green))))
  517. `(term-color-black ((,class (:foreground ,default :background ,background-darker))))
  518. `(term-color-red ((,class (:foreground ,red :background ,background-red))))
  519. `(term-color-green ((,class (:foreground ,green :background ,background-green))))
  520. `(term-color-yellow ((,class (:foreground ,orange :background ,background-orange))))
  521. `(term-color-blue ((,class (:foreground ,blue :background ,background-blue))))
  522. `(term-color-magenta ((,class (:foreground ,purple :background ,background-purple))))
  523. `(term-color-cyan ((,class (:foreground ,blue-dark))))
  524. `(term-color-white ((,class (:foreground ,grey))))
  525. `(term ((,class (:foreground ,default :background ,background))))
  526. `(term-default-fg-color ((,class (:inherit term-color-white))))
  527. `(term-default-bg-color ((,class (:inherit term-color-black))))
  528. `(sh-heredoc ((,class (:foreground ,orange :weight bold))))
  529. `(avy-lead-face ((,class :foreground ,red :background ,background-red)))
  530. `(avy-lead-face-0 ((,class :foreground ,purple :background ,background-purple)))
  531. `(avy-lead-face-1 ((,class :foreground ,blue :background ,background-blue)))
  532. `(avy-lead-face-2 ((,class :foreground ,green :background ,background-green)))
  533. `(erc-nick-default-face ((,class :foreground ,blue :background ,background-blue :weight bold)))
  534. `(erc-current-nick-face ((,class :foreground ,red :weight bold :background ,background-red)))
  535. `(erc-my-nick-face ((,class :foreground ,red :weight bold :background ,background-red)))
  536. `(erc-notice-face ((,class :foreground ,comment)))
  537. `(erc-input-face ((,class :foreground ,default :weight bold)))
  538. `(erc-prompt-face ((,class :foreground ,purple :background ,background-purple :weight bold :box 1)))
  539. `(erc-timestamp-face ((,class :foreground ,purple :weight bold)))
  540. `(hydra-face-red ((,class :foreground ,red :weight bold)))
  541. `(hydra-face-blue ((,class :foreground ,blue :weight bold)))
  542. ;; elfeed
  543. `(elfeed-search-date-face ((,class (:foreground ,blue))))
  544. `(elfeed-search-feed-face ((,class (:foreground ,blue))))
  545. `(elfeed-search-tag-face ((,class (:foreground ,green))))
  546. `(elfeed-search-title-face ((,class (:foreground ,purple))))
  547. ;; wgrep
  548. `(wgrep-face ((,class (:foreground ,orange))))
  549. `(wgrep-reject-face ((,class (:foreground ,red :weight bold :background ,background-red))))
  550. `(wgrep-done-face ((,class (:foreground ,blue :weight bold))))
  551. ;; AucTeX
  552. `(font-latex-math-face ((,class :foreground ,green-light)))
  553. `(font-latex-sectioning-5-face ((,class :foreground ,blue)))
  554. `(font-latex-string-face ((,class :inherit font-lock-string-face)))
  555. `(font-latex-warning-face ((,class :inherit warning)))
  556. ;; Anzu
  557. `(anzu-replace-highlight ((,class :foreground ,red :background ,background-red :strike-through t)))
  558. `(anzu-replace-to ((,class :foreground ,green :background ,background-green)))
  559. `(anzu-match-1 ((,class :foreground ,red :background ,background-red :box t)))
  560. `(anzu-match-2 ((,class :foreground ,red :background ,background-red :box t)))
  561. `(anzu-match-3 ((,class :foreground ,red :background ,background-red :box t)))
  562. `(anzu-mode-line ((,class :inherit mode-line :weight bold)))
  563. ;; jabber.el
  564. `(jabber-roster-user-online ((,class :foreground ,blue :weight bold)))
  565. `(jabber-roster-user-error ((,class :foreground ,red :background ,background-red :weight bold)))
  566. `(jabber-rare-time-face ((,class :foreground ,comment)))
  567. `(jabber-chat-prompt-local ((,class :foreground ,purple :background ,background-purple :weight bold)))
  568. `(jabber-chat-prompt-foreign ((,class :foreground ,green :background ,background-green :weight bold)))
  569. `(jabber-activity-personal-face ((,class :foreground ,red :background ,background-red :weight bold)))
  570. `(jabber-roster-user-away ((,class :foreground ,orange)))
  571. `(jabber-roster-user-xa ((,class :foreground ,orange)))
  572. ;; ace-window
  573. `(aw-leading-char-face ((,class :foreground ,red :weight bold)))
  574. `(aw-background-face ((,class :foreground ,comment)))
  575. ;; paren-face.el
  576. `(parenthesis ((,class (:foreground ,comment))))
  577. ;; rainbow-delimiters
  578. `(rainbow-delimiters-mismatched-face ((,class :foreground ,red :weight bold :background ,background-red)))
  579. `(rainbow-delimiters-unmatched-face ((,class :foreground ,red :weight bold :background ,background-red)))
  580. ;; makefile
  581. `(makefile-space ((,class (:background ,background-blue))))
  582. ;; epa
  583. `(epa-validity-high ((,class (:foreground ,green))))
  584. `(epa-validity-low ((,class (:foreground ,default))))
  585. `(epa-validity-disabled ((,class (:foreground ,red :weight bold :background ,background-red))))
  586. `(epa-field-name ((,class (:foreground ,purple :weight bold))))
  587. `(epa-field-body ((,class (:foreground ,orange))))
  588. )
  589. (custom-theme-set-variables
  590. 'zerodark
  591. `(ansi-color-names-vector [,background
  592. ,red
  593. ,green
  594. ,orange
  595. ,blue
  596. ,purple
  597. ,blue-dark
  598. ,default])))
  599. (defun zerodark-face-when-active (face)
  600. "Return FACE if the window is active."
  601. (when (zerodark--active-window-p)
  602. face))
  603. ;; So the mode-line can keep track of "the current window"
  604. (defvar zerodark-selected-window nil
  605. "Selected window.")
  606. (defun zerodark--set-selected-window (&rest _)
  607. "Set the selected window."
  608. (let ((window (frame-selected-window)))
  609. (when (and (windowp window)
  610. (not (minibuffer-window-active-p window)))
  611. (setq zerodark-selected-window window))))
  612. (defun zerodark--active-window-p ()
  613. "Return non-nil if the current window is active."
  614. (eq (selected-window) zerodark-selected-window))
  615. (add-hook 'window-configuration-change-hook #'zerodark--set-selected-window)
  616. (add-hook 'focus-in-hook #'zerodark--set-selected-window)
  617. (advice-add 'select-window :after #'zerodark--set-selected-window)
  618. (advice-add 'select-frame :after #'zerodark--set-selected-window)
  619. ;;;###autoload
  620. (defun zerodark-setup-modeline-format ()
  621. "Setup the mode-line format for zerodark."
  622. (interactive)
  623. (require 'flycheck)
  624. (require 'magit)
  625. (let ((class '((class color) (min-colors 89)))
  626. (light (if (true-color-p) "#ccd4e3" "#d7d7d7"))
  627. (comment (if (true-color-p) "#687080" "#707070"))
  628. (purple "#c678dd")
  629. (mode-line (if "#1c2129" "#222222")))
  630. (custom-theme-set-faces
  631. 'zerodark
  632. ;; Mode line faces
  633. `(mode-line ((,class (:background ,mode-line
  634. :height 0.9
  635. :foreground ,light
  636. :box ,(when zerodark-use-paddings-in-mode-line
  637. (list :line-width 6 :color mode-line))))))
  638. `(mode-line-inactive ((,class (:background ,mode-line
  639. :height 0.9
  640. :foreground ,comment
  641. :box ,(when zerodark-use-paddings-in-mode-line
  642. (list :line-width 6 :color mode-line))))))
  643. `(anzu-mode-line ((,class :inherit mode-line :foreground ,purple :weight bold)))
  644. ))
  645. (setq-default mode-line-format
  646. `("%e"
  647. " "
  648. ,zerodark-modeline-ro " "
  649. ,zerodark-buffer-coding
  650. mode-line-frame-identification " "
  651. " "
  652. ,zerodark-modeline-modified
  653. " "
  654. ,zerodark-modeline-buffer-identification
  655. ,zerodark-modeline-position
  656. ,zerodark-modeline-vc
  657. " "
  658. (:eval (zerodark-modeline-flycheck-status))
  659. " " mode-line-modes mode-line-misc-info mode-line-end-spaces
  660. )))
  661. ;;;###autoload
  662. (when (and (boundp 'custom-theme-load-path) load-file-name)
  663. (add-to-list 'custom-theme-load-path
  664. (file-name-as-directory (file-name-directory load-file-name))))
  665. (provide-theme 'zerodark)
  666. ;; Local Variables:
  667. ;; no-byte-compile: t
  668. ;; End:
  669. ;;; zerodark-theme.el ends here