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.

780 lines
40 KiB

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