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.

775 lines
40 KiB

5 years ago
6 years ago
6 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
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: 3.6
  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. (background-purple (if (true-color-p) "#48384c" "#5f5f5f"))
  165. (background-blue (if (true-color-p) "#38394c" "#444444"))
  166. (background-green (if (true-color-p) "#3d4a41" "#5f5f5f"))
  167. (background-orange (if (true-color-p) "#4a473d" "#5f5f5f"))
  168. (hl-line (if (true-color-p) "#2c323b" "#333333"))
  169. (grey (if (true-color-p) "#cccccc" "#cccccc"))
  170. (grey-dark (if (true-color-p) "#666666" "#666666"))
  171. (highlight (if (true-color-p) "#3e4451" "#5f5f5f"))
  172. (comment (if (true-color-p) "#687080" "#707070"))
  173. (orange (if (true-color-p) "#da8548" "#d7875f"))
  174. (orange-light (if (true-color-p) "#ddbd78" "#d7af87"))
  175. (red (if (true-color-p) "#ff6c6b" "#ff5f5f"))
  176. (purple (if (true-color-p) "#c678dd" "#d787d7"))
  177. (purple-dark (if (true-color-p) "#64446d" "#5f5f5f"))
  178. (blue (if (true-color-p) "#61afef" "#5fafff"))
  179. (blue-dark (if (true-color-p) "#1f5582" "#005f87"))
  180. (green (if (true-color-p) "#98be65" "#87af5f"))
  181. (green-light (if (true-color-p) "#9eac8c" "#afaf87"))
  182. (peach "PeachPuff3")
  183. (diff-added-background (if (true-color-p) "#284437" "#284437"))
  184. (diff-added-refined-background (if (true-color-p) "#1e8967" "#1e8967"))
  185. (diff-removed-background (if (true-color-p) "#583333" "#580000"))
  186. (diff-removed-refined-background (if (true-color-p) "#b33c49" "#b33c49"))
  187. (diff-current-background (if (true-color-p) "#29457b" "#29457b"))
  188. (diff-current-refined-background (if (true-color-p) "#4174ae" "#4174ae")))
  189. (custom-theme-set-faces
  190. 'zerodark
  191. `(default ((,class (:background ,background :foreground ,default))))
  192. `(cursor ((,class (:background ,default))))
  193. ;; Highlighting faces
  194. `(fringe ((,class (:background ,background-dark :foreground ,comment))))
  195. `(border ((,class (:foreground ,background-lighter))))
  196. `(vertical-border ((,class (:foreground ,background-lighter))))
  197. `(highlight ((,class (:background ,highlight :foreground ,default :underline nil))))
  198. `(region ((,class (:background ,highlight :foreground ,default))))
  199. `(secondary-selection ((,class (:background ,highlight :foreground ,default))))
  200. `(isearch ((,class (:background ,orange-light :foreground ,highlight))))
  201. `(lazy-highlight ((,class (:background ,grey-dark :foreground ,orange-light))))
  202. `(hl-line ((,class (:background ,hl-line :underline unspecified :inherit nil))))
  203. `(match ((,class (:background ,background-green))))
  204. ;; Font lock faces
  205. `(font-lock-builtin-face ((,class (:foreground ,blue :weight bold))))
  206. `(font-lock-comment-face ((,class (:foreground ,comment :slant italic))))
  207. `(font-lock-constant-face ((,class (:foreground ,orange :weight bold))))
  208. `(font-lock-function-name-face ((,class (:foreground ,blue))))
  209. `(font-lock-keyword-face ((,class (:foreground ,purple :weight bold))))
  210. `(font-lock-string-face ((,class (:foreground ,green))))
  211. `(font-lock-doc-face ((,class (:foreground ,green-light))))
  212. `(font-lock-type-face ((,class (:foreground ,blue))))
  213. `(font-lock-variable-name-face ((,class (:foreground ,blue))))
  214. `(font-lock-warning-face ((,class (:foreground ,red :weight bold :background ,background-red))))
  215. ;; Mode line faces
  216. `(mode-line ((,class (:background ,background-blue :height 0.9 :foreground ,blue
  217. :box ,(when zerodark-use-paddings-in-mode-line
  218. (list :line-width 6 :color background-blue))))))
  219. `(mode-line-inactive ((,class (:background ,background-darker :height 0.9 :foreground ,default
  220. :box ,(when zerodark-use-paddings-in-mode-line
  221. (list :line-width 6 :color background-darker))))))
  222. `(header-line ((,class (:inherit mode-line-inactive))))
  223. ;; error & success
  224. `(error ((,class (:foreground ,red :weight bold))))
  225. `(warning ((,class (:foreground ,orange :weight bold))))
  226. `(success ((,class (:foreground ,green :weight bold))))
  227. ;; powerline
  228. `(powerline-active1 ((,class (:height 0.9 :foreground ,blue :background ,background-darker))))
  229. `(powerline-active2 ((,class (:height 0.9 :foreground ,blue :background ,background-lighter))))
  230. ;; mml
  231. `(message-mml-face ((,class (:foreground ,comment))))
  232. ;; Org-clock mode line
  233. `(org-mode-line-clock ((,class (:background unspecified (:inherit mode-line)))))
  234. ;; Escape and prompt faces
  235. `(minibuffer-prompt ((,class (:foreground ,blue :weight bold))))
  236. `(escape-glyph ((,class (:foreground ,blue :weight bold))))
  237. ;; linum
  238. `(linum ((,class (:foreground ,comment :background ,background))))
  239. ;; from hlinum
  240. `(linum-highlight-face ((,class (:foreground ,blue ,background ,background-blue))))
  241. ;; eshell
  242. `(eshell-prompt ((,class (:foreground ,orange :background ,background :weight bold))))
  243. `(eshell-ls-directory ((,class (:foreground ,purple :background ,background :weight bold))))
  244. `(eshell-ls-symlink ((,class (:foreground ,orange :background ,background :weight normal))))
  245. `(eshell-ls-executable ((,class (:foreground ,green :background ,background :weight bold))))
  246. ;; whitespace
  247. `(whitespace-space ((,class (:background unspecified :foreground ,highlight
  248. :inverse-video unspecified))))
  249. `(whitespace-hspace ((,class (:background unspecified :foreground ,highlight
  250. :inverse-video unspecified))))
  251. `(whitespace-tab ((,class (:background unspecified :foreground ,highlight
  252. :inverse-video unspecified))))
  253. `(whitespace-newline ((,class (:background unspecified :foreground ,highlight
  254. :inverse-video unspecified))))
  255. `(whitespace-trailing ((,class (:background ,red :foreground ,background :weight bold
  256. :inverse-video nil))))
  257. `(whitespace-line ((,class (:background unspecified :foreground ,red
  258. :inverse-video unspecified))))
  259. `(whitespace-space-before-tab ((,class (:inherit whitespace-space))))
  260. `(whitespace-space-after-tab ((,class (:inherit whitespace-space))))
  261. `(whitespace-indentation ((,class (:background unspecified :foreground ,highlight
  262. :inverse-video unspecified))))
  263. `(whitespace-empty ((,class (:background ,orange :foreground ,highlight
  264. :inverse-video unspecified))))
  265. ;; link faces
  266. `(link ((,class (:foreground ,blue :underline t))))
  267. `(link-visited ((,class (:foreground ,blue :underline t))))
  268. ;; widget faces
  269. `(widget-field ((,class (:background ,highlight :box (:line-width 1 :color ,comment)))))
  270. `(widget-button ((,class (:inherit link))))
  271. ;; custom
  272. `(custom-button ((,class (:background ,background-lighter :box (:line-width 2 :style released-button)))))
  273. `(custom-button-mouse ((,class (:background ,highlight :box (:line-width 2 :style released-button)))))
  274. `(custom-button-pressed ((,class (:background ,highlight :box (:line-width 2 :style pressed-button)))))
  275. `(custom-group-tag ((,class (:foreground ,purple :weight bold :height 1.4))))
  276. `(custom-variable-tag ((,class (:foreground ,purple :weight bold))))
  277. `(custom-state ((,class (:foreground ,green))))
  278. ;; compilation
  279. `(compilation-info ((,class (:foreground ,purple :weight bold))))
  280. `(compilation-warning ((,class (:foreground ,orange :weight bold))))
  281. `(compilation-error ((,class (:foreground ,red :weight bold))))
  282. `(compilation-line-number ((,class (:foreground ,green :weight bold))))
  283. `(compilation-mode-line-exit ((,class (:foreground ,green :weight bold :inverse-video nil))))
  284. `(compilation-mode-line-run ((,class (:foreground ,orange :weight bold))))
  285. `(compilation-mode-line-fail ((,class (:foreground ,red :weight bold))))
  286. ;; dired
  287. `(dired-header ((,class (:foreground ,blue :background ,background-blue :weight bold))))
  288. `(dired-directory ((,class (:foreground ,purple :weight bold))))
  289. ;; diff
  290. `(diff-removed ((,class (:background ,background-red :foreground ,red))))
  291. `(diff-added ((,class (:background ,background-green :foreground ,green))))
  292. `(diff-hunk-header ((,class (:background ,background-blue :weight bold :foreground ,blue))))
  293. `(diff-file-header ((,class (:weight bold))))
  294. `(diff-header ((,class (:background ,background :foreground ,blue))))
  295. `(diff-context ((,class (:foreground ,default))))
  296. `(diff-refine-added ((,class (:foreground ,green :background ,background-green :weight bold :underline t))))
  297. `(diff-refine-removed ((,class (:background ,background-red :foreground ,red :weight bold :underline t))))
  298. ;; ediff
  299. `(ediff-fine-diff-B ((,class (:inherit diff-refine-added))))
  300. `(ediff-current-diff-B ((,class (:inherit diff-added))))
  301. `(ediff-fine-diff-A ((,class (:inherit diff-refine-removed))))
  302. `(ediff-current-diff-A ((,class (:inherit diff-removed))))
  303. `(ediff-fine-diff-C ((,class (:foreground ,blue :background ,background-blue :weight bold :underline t))))
  304. `(ediff-current-diff-C ((,class (:background ,background-blue :foreground ,blue))))
  305. ;; magit
  306. `(magit-diff-context-highlight ((,class (:background ,background-darker))))
  307. `(magit-diff-file-heading ((,class (:weight bold :foreground ,blue))))
  308. `(magit-diff-file-heading-highlight ((,class (:weight bold :foreground ,blue :background ,background-blue))))
  309. `(magit-diff-removed-highlight ((,class (:inherit diff-removed))))
  310. `(magit-diff-removed ((,class (:inherit diff-removed))))
  311. `(magit-diff-added-highlight ((,class (:inherit diff-added))))
  312. `(magit-diff-added ((,class (:inherit diff-added))))
  313. `(magit-diff-lines-heading ((,class (:background ,blue-dark :foreground "white"))))
  314. `(magit-diff-hunk-heading ((,class (:background ,background-lighter))))
  315. `(magit-diff-hunk-heading-highlight ((,class (:background ,blue-dark))))
  316. `(magit-diff-hunk-heading ((,class (:background ,background-lighter))))
  317. `(magit-process-ok ((,class (:foreground ,green :weight bold))))
  318. `(magit-section-highlight ((,class (:background ,background-darker))))
  319. `(magit-section-heading ((,class (:foreground ,grey :weight bold))))
  320. `(magit-branch-current ((,class (:foreground ,blue :background ,background-darker :box 1))))
  321. `(magit-branch-local ((,class (:foreground ,purple :background ,background-darker :box 1))))
  322. `(magit-branch-remote ((,class (:foreground ,green :background ,background-darker :box 1))))
  323. `(magit-reflog-reset ((,class (:background ,background-red :foreground ,red :weight bold))))
  324. `(magit-reflog-amend ((,class (:background ,background-blue :foreground ,blue :weight bold))))
  325. `(magit-reflog-rebase ((,class (:background ,background-blue :foreground ,blue :weight bold))))
  326. `(magit-reflog-commit ((,class (:background ,background-green :foreground ,green :weight bold))))
  327. `(magit-reflog-checkout ((,class (:background ,background-orange :foreground ,orange :weight bold))))
  328. `(magit-reflog-cherry-pick ((,class (:background ,background-purple :foreground ,purple :weight bold))))
  329. `(magit-bisect-bad ((,class (:background ,background-red :foreground ,red :box 1))))
  330. `(magit-bisect-good ((,class (:background ,background-blue :foreground ,blue :box 1))))
  331. `(magit-blame-heading ((,class (:foreground ,green :background ,background-green :box 1))))
  332. `(git-commit-summary ((,class (:weight bold))))
  333. `(magit-tag ((,class (:foreground ,purple :weight bold :box 1 :background "#202020"))))
  334. `(magit-sequence-part ((,class (:foreground ,orange :weight bold))))
  335. `(magit-sequence-head ((,class (:foreground ,green :weight bold))))
  336. ;; Message faces
  337. `(message-header-name ((,class (:foreground ,blue :weight bold))))
  338. `(message-header-cc ((,class (:foreground ,purple))))
  339. `(message-header-other ((,class (:foreground ,purple))))
  340. `(message-header-subject ((,class (:foreground ,green))))
  341. `(message-header-to ((,class (:foreground ,purple))))
  342. `(message-cited-text ((,class (:foreground ,comment))))
  343. `(message-separator ((,class (:foreground ,red :weight bold))))
  344. ;; ido faces
  345. `(ido-first-match ((,class (:foreground ,purple :weight bold))))
  346. `(ido-only-match ((,class (:foreground ,purple :weight bold))))
  347. `(ido-subdir ((,class (:foreground ,blue))))
  348. ;; notmuch
  349. `(notmuch-message-summary-face ((,class (:background ,highlight :box (:line-width 2 :color ,background)))))
  350. `(notmuch-search-count ((,class (:foreground ,red :weight bold))))
  351. `(notmuch-search-matching-authors ((,class (:foreground ,comment))))
  352. `(notmuch-search-subject ((,class (:foreground ,default))))
  353. `(notmuch-search-unread-face ((,class (:weight bold))))
  354. `(notmuch-search-date ((,class (:foreground ,purple))))
  355. `(notmuch-crypto-part-header ((,class (:foreground ,blue))))
  356. `(notmuch-crypto-decryption ((,class (:foreground ,purple))))
  357. `(notmuch-crypto-signature-unknown ((,class (:foreground ,red))))
  358. `(notmuch-crypto-signature-good ((,class (:background ,blue :foreground ,background :weight bold))))
  359. `(notmuch-crypto-signature-good-key ((,class (:background ,blue :foreground ,background :weight bold))))
  360. `(notmuch-crypto-signature-bad ((,class (:background ,red :foreground ,background :weight bold))))
  361. `(notmuch-tag-face ((,class (:foreground ,green :weight bold))))
  362. `(notmuch-tree-match-author-face ((,class (:foreground ,purple))))
  363. `(notmuch-tree-match-tag-face ((,class (:foreground ,green :weight bold))))
  364. ;; company
  365. `(company-preview ((,class (:background ,background-darker :foreground ,default))))
  366. `(company-preview-common ((,class (:background ,background-darker :foreground ,purple))))
  367. `(company-preview-search ((,class (:background ,blue :foreground ,default))))
  368. `(company-tooltip ((,class (:background ,background-darker :foreground ,default))))
  369. `(company-scrollbar-bg ((,class (:background ,background-darker))))
  370. `(company-scrollbar-fg ((,class (:background ,background-blue))))
  371. `(company-tooltip-common ((,class (:foreground ,purple :weight bold :background ,background-darker))))
  372. `(company-tooltip-annotation ((,class (:foreground ,blue :weight bold :background ,background-blue))))
  373. `(company-tooltip-common-selection ((,class (:foreground ,purple :background ,background-lighter :weight bold))))
  374. `(company-tooltip-selection ((,class (:foreground ,default :background ,background-lighter))))
  375. `(company-tooltip-mouse ((,class (:foreground ,default :background ,background-lighter))))
  376. ;; web-mode
  377. `(web-mode-html-tag-face ((,class (:foreground ,purple :weight bold))))
  378. `(web-mode-symbol-face ((,class (:foreground ,red :weight bold))))
  379. ;; js2-mode
  380. `(js2-function-param ((,class (:foreground ,blue))))
  381. `(js2-error ((,class (:foreground ,red))))
  382. ;; flycheck
  383. `(flycheck-fringe-error ((,class (:foreground ,red :background ,background-red :weight bold :inverse-video t))))
  384. `(flycheck-fringe-warning ((,class (:background ,background-orange :foreground ,orange :weight bold :inverse-video t))))
  385. `(flycheck-fringe-info ((,class (:background ,background-blue :foreground ,blue :weight bold :inverse-video t))))
  386. `(flycheck-warning ((,class (:underline (:color ,red :style wave)))))
  387. `(flycheck-error ((,class (:underline (:color ,red :style wave)))))
  388. ;; FIC
  389. `(font-lock-fic-face ((,class (:foreground ,background :background ,red :weight bold))))
  390. ;; org-mode todo
  391. `(org-hide ((,class (:foreground ,background))))
  392. `(org-todo ((,class (:foreground ,red :background ,background-red :weight bold))))
  393. `(org-done ((,class (:foreground ,blue :background ,background-blue :weight bold))))
  394. `(org-date ((,class (:background ,background-lighter))))
  395. `(org-scheduled-previously ((,class (:foreground ,red))))
  396. `(org-scheduled ((,class (:foreground ,default))))
  397. `(org-upcoming-deadline ((,class (:foreground ,orange))))
  398. `(org-headline-done ((,class (:foreground ,comment))))
  399. `(outline-1 ((,class (:foreground ,blue :weight bold))))
  400. `(outline-2 ((,class (:foreground ,purple :weight bold))))
  401. `(outline-3 ((,class (:weight bold :foreground ,default))))
  402. `(outline-4 ((,class (:weight bold :foreground ,default))))
  403. `(outline-5 ((,class (:weight bold :foreground ,default))))
  404. `(outline-6 ((,class (:weight bold :foreground ,default))))
  405. `(outline-7 ((,class (:weight bold :foreground ,default))))
  406. `(outline-8 ((,class (:weight bold :foreground ,default))))
  407. `(org-column-title ((,class (:foreground unspecified :background unspecified))))
  408. `(org-agenda-date ((,class (:foreground ,purple :weight bold))))
  409. `(org-agenda-date-today ((,class (:foreground ,blue :weight bold :background ,background-blue :box 1))))
  410. `(org-agenda-structure ((,class (:foreground ,blue :weight bold))))
  411. `(org-scheduled-today ((,class (:foreground ,default :weight bold))))
  412. `(org-agenda-done ((,class (:foreground ,comment))))
  413. `(org-time-grid ((,class (:foreground ,comment))))
  414. ;; org columns
  415. `(org-column ((,class (:background ,background-darker))))
  416. `(org-column-title ((,class (:background ,background-blue :foreground ,blue :weight bold))))
  417. ;; org blocks
  418. `(org-block-begin-line ((,class (:background ,background-green :foreground ,green-light :height 0.9))))
  419. `(org-block-end-line ((,class (:background ,background-green :foreground ,green-light :height 0.9))))
  420. ;; Gnus faces -- from wombat, feel free to improve :)
  421. `(gnus-group-news-1 ((,class (:weight bold :foreground "#95e454"))))
  422. `(gnus-group-news-1-low ((,class (:foreground "#95e454"))))
  423. `(gnus-group-news-2 ((,class (:weight bold :foreground "#cae682"))))
  424. `(gnus-group-news-2-low ((,class (:foreground "#cae682"))))
  425. `(gnus-group-news-3 ((,class (:weight bold :foreground "#ccaa8f"))))
  426. `(gnus-group-news-3-low ((,class (:foreground "#ccaa8f"))))
  427. `(gnus-group-news-4 ((,class (:weight bold :foreground "#99968b"))))
  428. `(gnus-group-news-4-low ((,class (:foreground "#99968b"))))
  429. `(gnus-group-news-5 ((,class (:weight bold :foreground "#cae682"))))
  430. `(gnus-group-news-5-low ((,class (:foreground "#cae682"))))
  431. `(gnus-group-news-low ((,class (:foreground "#99968b"))))
  432. `(gnus-group-mail-1 ((,class (:weight bold :foreground "#95e454"))))
  433. `(gnus-group-mail-1-low ((,class (:foreground "#95e454"))))
  434. `(gnus-group-mail-2 ((,class (:weight bold :foreground "#cae682"))))
  435. `(gnus-group-mail-2-low ((,class (:foreground "#cae682"))))
  436. `(gnus-group-mail-3 ((,class (:weight bold :foreground "#ccaa8f"))))
  437. `(gnus-group-mail-3-low ((,class (:foreground "#ccaa8f"))))
  438. `(gnus-group-mail-low ((,class (:foreground "#99968b"))))
  439. `(gnus-header-content ((,class (:foreground "#8ac6f2"))))
  440. `(gnus-header-from ((,class (:weight bold :foreground "#95e454"))))
  441. `(gnus-header-subject ((,class (:foreground "#cae682"))))
  442. `(gnus-header-name ((,class (:foreground "#8ac6f2"))))
  443. `(gnus-header-newsgroups ((,class (:foreground "#cae682"))))
  444. ;; which-function
  445. `(which-func ((,class (:foreground ,purple))))
  446. `(ediff-even-diff-A ((,class (:background ,highlight :foreground unspecified))))
  447. `(ediff-even-diff-B ((,class (:background ,highlight :foreground unspecified))))
  448. `(ediff-even-diff-C ((,class (:background ,highlight :foreground unspecified))))
  449. `(ediff-odd-diff-A ((,class (:background ,highlight :foreground unspecified))))
  450. `(ediff-odd-diff-B ((,class (:background ,highlight :foreground unspecified))))
  451. `(ediff-odd-diff-C ((,class (:background ,highlight :foreground unspecified))))
  452. ;; ivy
  453. `(ivy-current-match ((,class (:background ,background-purple :weight bold :foreground ,purple))))
  454. `(ivy-minibuffer-match-face-1 ((,class (:foreground ,orange))))
  455. `(ivy-minibuffer-match-face-2 ((,class (:foreground ,green))))
  456. `(ivy-minibuffer-match-face-3 ((,class (:foreground ,orange))))
  457. `(ivy-minibuffer-match-face-4 ((,class (:foreground ,green))))
  458. `(ivy-match-required-face ((,class (:foreground ,red :background ,background-red :weight bold))))
  459. `(ivy-modified-buffer ((,class (:foreground ,red))))
  460. `(ivy-remote ((,class (:foreground ,blue))))
  461. ;; helm
  462. `(helm-candidate-number ((,class (:weight bold))))
  463. `(helm-header-line-left-margin ((,class (:weight bold :foreground ,red))))
  464. `(helm-source-header ((,class (:height 1.2 :weight bold :foreground ,blue :background ,background-blue))))
  465. `(helm-selection ((,class (:background ,background-lighter))))
  466. `(helm-match ((,class (:foreground ,purple :background ,background-purple :weight bold))))
  467. `(helm-match-item ((,class (:inherit isearch))))
  468. `(helm-M-x-key ((,class (:foreground ,blue :weight bold :background ,background-blue))))
  469. `(helm-visible-mark ((,class (:weight bold :foreground ,orange :background ,background-darker))))
  470. `(helm-prefarg ((,class (:weight bold :foreground ,red :background ,background-red))))
  471. `(helm-separator ((,class (:weight bold :foreground , blue))))
  472. `(helm-grep-file ((,class ())))
  473. `(helm-grep-finish ((,class (:foreground ,green))))
  474. `(helm-grep-running ((,class (:foreground ,red))))
  475. `(helm-grep-lineno ((,class (:foreground ,blue))))
  476. `(helm-grep-match ((,class (:foreground ,purple :background ,background-purple :weight bold))))
  477. `(helm-moccur-buffer ((,class ())))
  478. `(helm-buffer-directory ((,class (:foreground ,purple))))
  479. `(helm-buffer-file ((,class ())))
  480. `(helm-buffer-process ((,class (:foreground ,purple))))
  481. `(helm-buffer-size ((,class (:foreground ,blue))))
  482. `(helm-buffer-saved-out ((,class (:foreground ,red :weight bold))))
  483. `(helm-ff-directory ((,class (:foreground ,purple))))
  484. `(helm-ff-dotted-directory ((,class (:foreground ,purple))))
  485. `(helm-ff-prefix ((,class (:weight bold :foreground ,red))))
  486. `(helm-ff-file ((,class ())))
  487. `(helm-ff-executable ((,class (:foreground ,green :weight bold :background ,background-green))))
  488. `(helm-ff-symlink ((,class (:foreground ,orange))))
  489. `(helm-ff-invalid-symlink ((,class (:foreground ,red :weight bold :background ,background-red))))
  490. `(helm-history-deleted ((,class (:foreground ,red :weight bold :background ,background-red))))
  491. ;; visible mark
  492. `(visible-mark-face1 ((,class (:foreground ,orange-light :inverse-video t))))
  493. `(visible-mark-face2 ((,class (:foreground ,peach :inverse-video t))))
  494. ;; show-paren
  495. `(show-paren-match ((,class (:background ,blue-dark))))
  496. ;; clojure
  497. `(clojure-keyword-face ((,class (:inherit font-lock-builtin-face))))
  498. ;; ledger
  499. `(ledger-font-report-clickable-face ((,class (:foreground ,blue))))
  500. `(ledger-font-posting-amount-face ((,class (:foreground ,purple))))
  501. `(ledger-font-posting-date-face ((,class (:foreground ,blue :background ,background-blue :box 1))))
  502. `(ledger-font-payee-uncleared-face ((,class (:foreground ,default :weight bold))))
  503. `(ledger-font-payee-cleared-face ((,class (:foreground ,green :weight bold))))
  504. `(ledger-font-posting-account-face ((,class (:foreground ,default))))
  505. `(ledger-font-posting-account-pending-face ((,class (:foreground ,red))))
  506. `(ledger-font-xact-highlight-face ((,class (:background ,background-darker))))
  507. `(ledger-font-other-face ((,class (:inherit ,font-lock-comment-face))))
  508. `(ledger-font-periodic-xact-face ((,class (:foreground ,orange))))
  509. `(diff-hl-change ((,class (:foreground ,purple :background ,background-purple))))
  510. `(diff-hl-delete ((,class (:foreground ,red :background ,background-red))))
  511. `(diff-hl-insert ((,class (:foreground ,green :background ,background-green))))
  512. `(term-color-black ((,class (:foreground ,default :background ,background-darker))))
  513. `(term-color-red ((,class (:foreground ,red :background ,background-red))))
  514. `(term-color-green ((,class (:foreground ,green :background ,background-green))))
  515. `(term-color-yellow ((,class (:foreground ,orange :background ,background-orange))))
  516. `(term-color-blue ((,class (:foreground ,blue :background ,background-blue))))
  517. `(term-color-magenta ((,class (:foreground ,purple :background ,background-purple))))
  518. `(term-color-cyan ((,class (:foreground ,blue-dark))))
  519. `(term-color-white ((,class (:foreground ,grey))))
  520. `(term ((,class (:foreground ,default :background ,background))))
  521. `(term-default-fg-color ((,class (:inherit term-color-white))))
  522. `(term-default-bg-color ((,class (:inherit term-color-black))))
  523. `(sh-heredoc ((,class (:foreground ,orange :weight bold))))
  524. `(avy-lead-face ((,class :foreground ,red :background ,background-red)))
  525. `(avy-lead-face-0 ((,class :foreground ,purple :background ,background-purple)))
  526. `(avy-lead-face-1 ((,class :foreground ,blue :background ,background-blue)))
  527. `(avy-lead-face-2 ((,class :foreground ,green :background ,background-green)))
  528. `(erc-nick-default-face ((,class :foreground ,blue :background ,background-blue :weight bold)))
  529. `(erc-current-nick-face ((,class :foreground ,red :weight bold :background ,background-red)))
  530. `(erc-my-nick-face ((,class :foreground ,red :weight bold :background ,background-red)))
  531. `(erc-notice-face ((,class :foreground ,comment)))
  532. `(erc-input-face ((,class :foreground ,default :weight bold)))
  533. `(erc-prompt-face ((,class :foreground ,purple :background ,background-purple :weight bold :box 1)))
  534. `(erc-timestamp-face ((,class :foreground ,purple :weight bold)))
  535. `(hydra-face-red ((,class :foreground ,red :weight bold)))
  536. `(hydra-face-blue ((,class :foreground ,blue :weight bold)))
  537. ;; elfeed
  538. `(elfeed-search-date-face ((,class (:foreground ,blue))))
  539. `(elfeed-search-feed-face ((,class (:foreground ,blue))))
  540. `(elfeed-search-tag-face ((,class (:foreground ,green))))
  541. `(elfeed-search-title-face ((,class (:foreground ,purple))))
  542. ;; wgrep
  543. `(wgrep-face ((,class (:foreground ,orange))))
  544. `(wgrep-reject-face ((,class (:foreground ,red :weight bold :background ,background-red))))
  545. `(wgrep-done-face ((,class (:foreground ,blue :weight bold))))
  546. ;; AucTeX
  547. `(font-latex-math-face ((,class :foreground ,green-light)))
  548. `(font-latex-sectioning-5-face ((,class :foreground ,blue)))
  549. `(font-latex-string-face ((,class :inherit font-lock-string-face)))
  550. `(font-latex-warning-face ((,class :inherit warning)))
  551. ;; Anzu
  552. `(anzu-replace-highlight ((,class :foreground ,red :background ,background-red :strike-through t)))
  553. `(anzu-replace-to ((,class :foreground ,green :background ,background-green)))
  554. `(anzu-match-1 ((,class :foreground ,red :background ,background-red :box t)))
  555. `(anzu-match-2 ((,class :foreground ,red :background ,background-red :box t)))
  556. `(anzu-match-3 ((,class :foreground ,red :background ,background-red :box t)))
  557. `(anzu-mode-line ((,class :inherit mode-line :weight bold)))
  558. ;; jabber.el
  559. `(jabber-roster-user-online ((,class :foreground ,blue :weight bold)))
  560. `(jabber-roster-user-error ((,class :foreground ,red :background ,background-red :weight bold)))
  561. `(jabber-rare-time-face ((,class :foreground ,comment)))
  562. `(jabber-chat-prompt-local ((,class :foreground ,purple :background ,background-purple :weight bold)))
  563. `(jabber-chat-prompt-foreign ((,class :foreground ,green :background ,background-green :weight bold)))
  564. `(jabber-activity-personal-face ((,class :foreground ,red :background ,background-red :weight bold)))
  565. `(jabber-roster-user-away ((,class :foreground ,orange)))
  566. `(jabber-roster-user-xa ((,class :foreground ,orange)))
  567. ;; ace-window
  568. `(aw-leading-char-face ((,class :foreground ,red :weight bold)))
  569. `(aw-background-face ((,class :foreground ,comment)))
  570. ;; paren-face.el
  571. `(parenthesis ((,class (:foreground ,comment))))
  572. ;; makefile
  573. `(makefile-space ((,class (:background ,background-blue))))
  574. ;; epa
  575. `(epa-validity-high ((,class (:foreground ,green))))
  576. `(epa-validity-low ((,class (:foreground ,default))))
  577. `(epa-validity-disabled ((,class (:foreground ,red :weight bold :background ,background-red))))
  578. `(epa-field-name ((,class (:foreground ,purple :weight bold))))
  579. `(epa-field-body ((,class (:foreground ,orange))))
  580. )
  581. (custom-theme-set-variables
  582. 'zerodark
  583. `(ansi-color-names-vector [,background
  584. ,red
  585. ,green
  586. ,orange
  587. ,blue
  588. ,purple
  589. ,blue-dark
  590. ,default])))
  591. (defun zerodark-face-when-active (face)
  592. "Return FACE if the window is active."
  593. (when (zerodark--active-window-p)
  594. face))
  595. ;; So the mode-line can keep track of "the current window"
  596. (defvar zerodark-selected-window nil
  597. "Selected window.")
  598. (defun zerodark--set-selected-window (&rest _)
  599. "Set the selected window."
  600. (let ((window (frame-selected-window)))
  601. (when (and (windowp window)
  602. (not (minibuffer-window-active-p window)))
  603. (setq zerodark-selected-window window))))
  604. (defun zerodark--active-window-p ()
  605. "Return non-nil if the current window is active."
  606. (eq (selected-window) zerodark-selected-window))
  607. (add-hook 'window-configuration-change-hook #'zerodark--set-selected-window)
  608. (add-hook 'focus-in-hook #'zerodark--set-selected-window)
  609. (advice-add 'select-window :after #'zerodark--set-selected-window)
  610. (advice-add 'select-frame :after #'zerodark--set-selected-window)
  611. ;;;###autoload
  612. (defun zerodark-setup-modeline-format ()
  613. "Setup the mode-line format for zerodark."
  614. (interactive)
  615. (require 'flycheck)
  616. (require 'magit)
  617. (let ((class '((class color) (min-colors 89)))
  618. (light (if (true-color-p) "#ccd4e3" "#d7d7d7"))
  619. (comment (if (true-color-p) "#687080" "#707070"))
  620. (purple "#c678dd")
  621. (mode-line (if "#1c2129" "#222222")))
  622. (custom-theme-set-faces
  623. 'zerodark
  624. ;; Mode line faces
  625. `(mode-line ((,class (:background ,mode-line
  626. :height 0.9
  627. :foreground ,light
  628. :box ,(when zerodark-use-paddings-in-mode-line
  629. (list :line-width 6 :color mode-line))))))
  630. `(mode-line-inactive ((,class (:background ,mode-line
  631. :height 0.9
  632. :foreground ,comment
  633. :box ,(when zerodark-use-paddings-in-mode-line
  634. (list :line-width 6 :color mode-line))))))
  635. `(anzu-mode-line ((,class :inherit mode-line :foreground ,purple :weight bold)))
  636. ))
  637. (setq-default mode-line-format
  638. `("%e"
  639. " "
  640. ,zerodark-modeline-ro " "
  641. ,zerodark-buffer-coding
  642. mode-line-frame-identification " "
  643. " "
  644. ,zerodark-modeline-modified
  645. " "
  646. ,zerodark-modeline-buffer-identification
  647. ,zerodark-modeline-position
  648. ,zerodark-modeline-vc
  649. " "
  650. (:eval (zerodark-modeline-flycheck-status))
  651. " " mode-line-modes mode-line-misc-info mode-line-end-spaces
  652. )))
  653. ;;;###autoload
  654. (when (and (boundp 'custom-theme-load-path) load-file-name)
  655. (add-to-list 'custom-theme-load-path
  656. (file-name-as-directory (file-name-directory load-file-name))))
  657. (provide-theme 'zerodark)
  658. ;; Local Variables:
  659. ;; no-byte-compile: t
  660. ;; End:
  661. ;;; zerodark-theme.el ends here