visual.el 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ;;; This file enforces consistency in the visual style:
  2. ;;; - doc, here-doc, comments, strings are in the same taint.
  3. ;;; - search highlight, search lazy follow the same color code.
  4. ;;; - diffs (ediff, smerge, etc.) follow the same color code.
  5. ;;; To find the variable associated to a currently used color, place the cursor
  6. ;;; on it and call `describe-face'. Or browse the `list-faces-display'.
  7. ;;; General
  8. (set-face-attribute 'default nil :foreground "white" :background "black")
  9. ;;; Font size
  10. (when (fboundp 'tool-bar-mode)
  11. ;; (set-face-attribute 'default nil :height 100)
  12. (add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-12")))
  13. ;;; More readable but more space consuming; try on big screens.
  14. ;; (setq-default line-spacing 1)
  15. (set-face-background 'mode-line "white")
  16. ;; (set-face-foreground 'link "#00ffff")
  17. (set-face-underline 'link t)
  18. (set-face-foreground 'minibuffer-prompt "#00ffff")
  19. (set-face-background 'region "#191970")
  20. (set-face-attribute 'isearch nil :foreground 'unspecified :background "#2f4f4f" :box "white")
  21. (set-face-attribute 'lazy-highlight nil :inherit 'isearch :foreground 'unspecified :background 'unspecified :box nil)
  22. ;;; TODO: Highlight with box does not render well in Sx, ediff, occur, evil-search.
  23. (set-face-attribute 'highlight nil :background 'unspecified :box "white")
  24. (set-face-attribute 'error nil :foreground "red" :weight 'bold)
  25. ;;; Cursor type: default (box) is visible and practical.
  26. ;; (setq-default cursor-type 'hollow)
  27. (setq-default x-stretch-cursor t)
  28. ;;; Blinking cursor is on only when Emacs is not daemonized.
  29. (blink-cursor-mode 0)
  30. ;;; Line numbers.
  31. ;;; Graphic version has a gray bar separating text from line
  32. ;;; numbers, so we can leave the background black.
  33. (if (display-graphic-p)
  34. (set-face-background 'shadow "black")
  35. (set-face-background 'shadow "#1c1c1c"))
  36. ;;; Whitespace mode
  37. (with-eval-after-load 'whitespace
  38. (set-face-background 'whitespace-space-after-tab "#a9a9a9")
  39. (set-face-background 'whitespace-indentation "#696969"))
  40. ;;; Programming
  41. (set-face-foreground 'font-lock-comment-face "#00ced1")
  42. (set-face-foreground 'font-lock-comment-delimiter-face (face-foreground 'font-lock-comment-face))
  43. (set-face-foreground 'font-lock-doc-face "#00dfff")
  44. (set-face-foreground 'font-lock-string-face "#0080d4")
  45. (set-face-foreground 'font-lock-builtin-face (face-foreground 'default))
  46. (set-face-foreground 'font-lock-constant-face (face-foreground 'default))
  47. (set-face-foreground 'font-lock-function-name-face (face-foreground 'default))
  48. (set-face-foreground 'font-lock-keyword-face (face-foreground 'default))
  49. (set-face-foreground 'font-lock-type-face (face-foreground 'default))
  50. (set-face-foreground 'font-lock-variable-name-face (face-foreground 'default))
  51. ;;; Compilation mode
  52. (with-eval-after-load 'compile
  53. (set-face-foreground 'compilation-column-number "cyan")
  54. (set-face-foreground 'compilation-line-number "cyan"))
  55. ;;; Ediff
  56. (with-eval-after-load 'ediff-init
  57. (set-face-attribute 'ediff-even-diff-A nil :inherit 'ediff-current-diff-A :foreground 'unspecified :background 'unspecified :box nil)
  58. (set-face-attribute 'ediff-odd-diff-A nil :inherit 'ediff-current-diff-A :foreground 'unspecified :background 'unspecified :box nil)
  59. (set-face-attribute 'ediff-even-diff-B nil :inherit 'ediff-current-diff-B :foreground 'unspecified :background 'unspecified :box nil)
  60. (set-face-attribute 'ediff-odd-diff-B nil :inherit 'ediff-current-diff-B :foreground 'unspecified :background 'unspecified :box nil)
  61. (set-face-attribute 'ediff-even-diff-C nil :inherit 'ediff-current-diff-C :foreground 'unspecified :background 'unspecified :box nil)
  62. (set-face-attribute 'ediff-odd-diff-C nil :inherit 'ediff-current-diff-C :foreground 'unspecified :background 'unspecified :box nil)
  63. (set-face-attribute 'ediff-current-diff-A nil :box "white")
  64. (set-face-attribute 'ediff-current-diff-B nil :box "white")
  65. (set-face-attribute 'ediff-current-diff-C nil :box "white"))
  66. ;;; Outline mode
  67. (with-eval-after-load 'outline
  68. ;; (set-face-attribute 'outline-1 nil :inherit 'font-lock-warning-face)
  69. (set-face-attribute 'outline-1 nil :weight 'bold :foreground "#CBAC42")
  70. (set-face-attribute 'outline-2 nil :weight 'bold :foreground "#7BBF11")
  71. (set-face-attribute 'outline-3 nil :weight 'bold :foreground "#BC684F")
  72. (set-face-attribute 'outline-4 nil :weight 'bold :foreground "#4C95BF")
  73. (set-face-attribute 'outline-5 nil :weight 'bold :foreground "SeaGreen")
  74. (set-face-attribute 'outline-6 nil :weight 'bold :foreground "DarkSlateGray4")
  75. (set-face-attribute 'outline-7 nil :weight 'bold :foreground "DarkSlateBlue")
  76. (set-face-attribute 'outline-8 nil :weight 'bold :foreground "Gold"))
  77. ;;; show-paren
  78. (with-eval-after-load 'paren
  79. ;; (set-face-background 'show-paren-match-face (face-background 'default)) ; Disable background color.
  80. (set-face-background 'show-paren-match "#555555")
  81. (set-face-foreground 'show-paren-match "#def")
  82. (set-face-attribute 'show-paren-match nil :weight 'extra-bold))
  83. ;;; Mail mode
  84. (font-lock-add-keywords
  85. 'mail-mode
  86. '(
  87. ("^From:" . font-lock-warning-face)
  88. ("^To:" . font-lock-warning-face)
  89. ("^Newsgroups:" . font-lock-warning-face)
  90. ("^B?CC:" . font-lock-warning-face)
  91. ("^Subject:" . font-lock-warning-face)
  92. ("^Reply-To:" . font-lock-warning-face)
  93. ("^In-Reply-To:" . font-lock-warning-face)
  94. ;; Mail addresses.
  95. ("\\([[:alnum:]._-]+@[[:alnum:]._-]+\.[[:alnum:]._-]+\\)" 1 font-lock-string-face)
  96. ;; Quotes.
  97. ("^\> *\\([^\> ]\\).*$" . font-lock-string-face)
  98. ("^\> *\> *\\([^\> ]\\).*$" . font-lock-doc-face)
  99. ("^\> *\> *\> *\\([^\> ]\\).*$" . font-lock-comment-face)
  100. ("^\> *\> *\> *\> *\\([^\> ]\\).*$" . font-lock-comment-face)
  101. ("^\> *\> *\> *\> *\> *\\([^\> ]\\).*$" . font-lock-comment-face)
  102. ("^\> *\> *\> *\> *\> *\> *\\([^\> ]\\).*$" . font-lock-comment-face)
  103. ("^\> *\> *\> *\> *\> *\> *\> *\\([^\> ]\\).*$" . font-lock-comment-face)
  104. ("^\> *\> *\> *\> *\> *\> *\> *\> *\\([^\> ]\\).*$" . font-lock-comment-face)
  105. ;; Signature (multi-line regexes are a bit flaky).
  106. ("^--.*\\(\n.*\\)*" . font-lock-comment-face)))
  107. ;;; Key notes highlighting. We need to apply it to the mode hook since
  108. ;;; font-lock-add-keywords has no inheritance support.
  109. (set-face-foreground 'font-lock-warning-face "DarkOrange")
  110. (defun ambrevar/fontify-comment-tag ()
  111. (font-lock-add-keywords
  112. nil
  113. ;; See https://en.wikipedia.org/wiki/Comment_(computer_programming)#Tags.
  114. (mapcar
  115. (lambda (keyword) `(,(concat "\\<\\(" keyword "\\):") 1 font-lock-warning-face prepend))
  116. '("FIXME\\(([^)]+)\\)?" "HACK" "OPTIMIZE\\(([^)]+)\\)?" "REVIEW\\(([^)]+)\\)?" "TODO\\(([^)]+)\\)?" "UNDONE" "UX" "WARNING" "XXX"))))
  117. (dolist (hook '(prog-mode-hook text-mode-hook))
  118. (add-hook hook 'ambrevar/fontify-comment-tag))
  119. ;;; Man pages
  120. (with-eval-after-load 'man
  121. (set-face-attribute 'Man-underline nil :foreground (face-foreground 'font-lock-string-face) :underline nil)
  122. (set-face-attribute 'Man-overstrike nil :foreground (face-foreground 'font-lock-comment-face) :weight 'normal))
  123. (with-eval-after-load 'woman
  124. (set-face-foreground 'woman-bold (face-foreground 'font-lock-comment-face)))
  125. ;;; Term
  126. ;;; Use lighter blue.
  127. (with-eval-after-load 'ansi-color
  128. (setf (aref ansi-color-map 34) '(foreground-color . "#1e90ff")))
  129. (provide 'visual)