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.

813 lines
42 KiB

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