org-faces.el 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. ;;; org-faces.el --- Face definitions for Org-mode.
  2. ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
  3. ;; Author: Carsten Dominik <carsten at orgmode dot org>
  4. ;; Keywords: outlines, hypermedia, calendar, wp
  5. ;; Homepage: http://orgmode.org
  6. ;; Version: 6.13pre02
  7. ;;
  8. ;; This file is part of GNU Emacs.
  9. ;;
  10. ;; GNU Emacs is free software: you can redistribute it and/or modify
  11. ;; it under the terms of the GNU General Public License as published by
  12. ;; the Free Software Foundation, either version 3 of the License, or
  13. ;; (at your option) any later version.
  14. ;; GNU Emacs is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;; GNU General Public License for more details.
  18. ;; You should have received a copy of the GNU General Public License
  19. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. ;;
  22. ;;; Commentary:
  23. ;; This file contains the face definitons for Org.
  24. ;;; Code:
  25. (require 'org-macs)
  26. (require 'org-compat)
  27. (defgroup org-faces nil
  28. "Faces in Org-mode."
  29. :tag "Org Faces"
  30. :group 'org-font-lock)
  31. (defface org-hide
  32. '((((background light)) (:foreground "white"))
  33. (((background dark)) (:foreground "black")))
  34. "Face used to hide leading stars in headlines.
  35. The foreground color of this face should be equal to the background
  36. color of the frame."
  37. :group 'org-faces)
  38. (defface org-level-1 ;; originally copied from font-lock-function-name-face
  39. (org-compatible-face 'outline-1
  40. '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
  41. (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
  42. (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
  43. (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
  44. (((class color) (min-colors 8)) (:foreground "blue" :bold t))
  45. (t (:bold t))))
  46. "Face used for level 1 headlines."
  47. :group 'org-faces)
  48. (defface org-level-2 ;; originally copied from font-lock-variable-name-face
  49. (org-compatible-face 'outline-2
  50. '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
  51. (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
  52. (((class color) (min-colors 8) (background light)) (:foreground "yellow"))
  53. (((class color) (min-colors 8) (background dark)) (:foreground "yellow" :bold t))
  54. (t (:bold t))))
  55. "Face used for level 2 headlines."
  56. :group 'org-faces)
  57. (defface org-level-3 ;; originally copied from font-lock-keyword-face
  58. (org-compatible-face 'outline-3
  59. '((((class color) (min-colors 88) (background light)) (:foreground "Purple"))
  60. (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
  61. (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
  62. (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
  63. (((class color) (min-colors 8) (background light)) (:foreground "purple" :bold t))
  64. (((class color) (min-colors 8) (background dark)) (:foreground "cyan" :bold t))
  65. (t (:bold t))))
  66. "Face used for level 3 headlines."
  67. :group 'org-faces)
  68. (defface org-level-4 ;; originally copied from font-lock-comment-face
  69. (org-compatible-face 'outline-4
  70. '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
  71. (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
  72. (((class color) (min-colors 16) (background light)) (:foreground "red"))
  73. (((class color) (min-colors 16) (background dark)) (:foreground "red1"))
  74. (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
  75. (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
  76. (t (:bold t))))
  77. "Face used for level 4 headlines."
  78. :group 'org-faces)
  79. (defface org-level-5 ;; originally copied from font-lock-type-face
  80. (org-compatible-face 'outline-5
  81. '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
  82. (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
  83. (((class color) (min-colors 8)) (:foreground "green"))))
  84. "Face used for level 5 headlines."
  85. :group 'org-faces)
  86. (defface org-level-6 ;; originally copied from font-lock-constant-face
  87. (org-compatible-face 'outline-6
  88. '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
  89. (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
  90. (((class color) (min-colors 8)) (:foreground "magenta"))))
  91. "Face used for level 6 headlines."
  92. :group 'org-faces)
  93. (defface org-level-7 ;; originally copied from font-lock-builtin-face
  94. (org-compatible-face 'outline-7
  95. '((((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
  96. (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
  97. (((class color) (min-colors 8)) (:foreground "blue"))))
  98. "Face used for level 7 headlines."
  99. :group 'org-faces)
  100. (defface org-level-8 ;; originally copied from font-lock-string-face
  101. (org-compatible-face 'outline-8
  102. '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
  103. (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
  104. (((class color) (min-colors 8)) (:foreground "green"))))
  105. "Face used for level 8 headlines."
  106. :group 'org-faces)
  107. (defface org-special-keyword ;; originally copied from font-lock-string-face
  108. (org-compatible-face nil
  109. '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
  110. (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
  111. (t (:italic t))))
  112. "Face used for special keywords."
  113. :group 'org-faces)
  114. (defface org-drawer ;; originally copied from font-lock-function-name-face
  115. (org-compatible-face nil
  116. '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
  117. (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
  118. (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
  119. (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
  120. (((class color) (min-colors 8)) (:foreground "blue" :bold t))
  121. (t (:bold t))))
  122. "Face used for drawers."
  123. :group 'org-faces)
  124. (defface org-property-value nil
  125. "Face used for the value of a property."
  126. :group 'org-faces)
  127. (defface org-column
  128. (org-compatible-face nil
  129. '((((class color) (min-colors 16) (background light))
  130. (:background "grey90" :weight normal :slant normal :strike-through nil
  131. :underline nil))
  132. (((class color) (min-colors 16) (background dark))
  133. (:background "grey30" :weight normal :slant normal :strike-through nil
  134. :underline nil))
  135. (((class color) (min-colors 8))
  136. (:background "cyan" :foreground "black"
  137. :weight normal :slant normal :strike-through nil
  138. :underline nil))
  139. (t (:inverse-video t))))
  140. "Face for column display of entry properties.
  141. This is actually only part of the face definition for the text in column view.
  142. The following faces apply, with this priority.
  143. 1. The color of the reference face. This is normally the level fact that
  144. is used in the outline. In agenda-mode, it will be the face of the
  145. first character in the line. The color is explicitly retained to
  146. make sure that the column line still looks a bit like the structure
  147. line it is masking.
  148. 2. The `org-column' face.
  149. 3. The remaining properties of the reference face.
  150. Since column view works by putting overlays with a display property
  151. over individual characters in the buffer, the face of the underlining
  152. character (this might for example be the a TODO keyword) might still
  153. shine through in some properties. So when your column view looks
  154. funny, with \"random\" colors, weight, strike-through, try to explicitly
  155. set the properties in the `org-column' face. For example, set
  156. :underline to nil, or the :slant to `normal'.
  157. Under XEmacs, the rules are simpler, because the XEmacs version of
  158. column view defines special faces for each outline level. See the file
  159. `org-colview-xemacs.el' for details."
  160. :group 'org-faces)
  161. (defface org-column-title
  162. (org-compatible-face nil
  163. '((((class color) (min-colors 16) (background light))
  164. (:background "grey90" :underline t :weight bold))
  165. (((class color) (min-colors 16) (background dark))
  166. (:background "grey30" :underline t :weight bold))
  167. (((class color) (min-colors 8))
  168. (:background "cyan" :foreground "black" :underline t :weight bold))
  169. (t (:inverse-video t))))
  170. "Face for column display of entry properties."
  171. :group 'org-faces)
  172. (when (fboundp 'set-face-attribute)
  173. ;; Make sure that a fixed-width face is used when we have a column table.
  174. (set-face-attribute 'org-column nil
  175. :height (face-attribute 'default :height)
  176. :family (face-attribute 'default :family)))
  177. (defface org-agenda-column-dateline
  178. (org-compatible-face 'org-column
  179. '((t nil)))
  180. "Face used in agenda column view for datelines with summaries."
  181. :group 'org-faces)
  182. (defface org-warning
  183. (org-compatible-face 'font-lock-warning-face
  184. '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
  185. (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
  186. (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
  187. (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
  188. (t (:bold t))))
  189. "Face for deadlines and TODO keywords."
  190. :group 'org-faces)
  191. (defface org-archived ; similar to shadow
  192. (org-compatible-face 'shadow
  193. '((((class color grayscale) (min-colors 88) (background light))
  194. (:foreground "grey50"))
  195. (((class color grayscale) (min-colors 88) (background dark))
  196. (:foreground "grey70"))
  197. (((class color) (min-colors 8) (background light))
  198. (:foreground "green"))
  199. (((class color) (min-colors 8) (background dark))
  200. (:foreground "yellow"))))
  201. "Face for headline with the ARCHIVE tag."
  202. :group 'org-faces)
  203. (defface org-link
  204. '((((class color) (background light)) (:foreground "Purple" :underline t))
  205. (((class color) (background dark)) (:foreground "Cyan" :underline t))
  206. (t (:underline t)))
  207. "Face for links."
  208. :group 'org-faces)
  209. (defface org-ellipsis
  210. '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
  211. (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
  212. (t (:strike-through t)))
  213. "Face for the ellipsis in folded text."
  214. :group 'org-faces)
  215. (defface org-target
  216. '((((class color) (background light)) (:underline t))
  217. (((class color) (background dark)) (:underline t))
  218. (t (:underline t)))
  219. "Face for links."
  220. :group 'org-faces)
  221. (defface org-date
  222. '((((class color) (background light)) (:foreground "Purple" :underline t))
  223. (((class color) (background dark)) (:foreground "Cyan" :underline t))
  224. (t (:underline t)))
  225. "Face for links."
  226. :group 'org-faces)
  227. (defface org-sexp-date
  228. '((((class color) (background light)) (:foreground "Purple"))
  229. (((class color) (background dark)) (:foreground "Cyan"))
  230. (t (:underline t)))
  231. "Face for links."
  232. :group 'org-faces)
  233. (defface org-tag
  234. '((t (:bold t)))
  235. "Face for tags."
  236. :group 'org-faces)
  237. (defface org-todo ; font-lock-warning-face
  238. (org-compatible-face nil
  239. '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
  240. (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
  241. (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
  242. (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
  243. (t (:inverse-video t :bold t))))
  244. "Face for TODO keywords."
  245. :group 'org-faces)
  246. (defface org-done ;; originally copied from font-lock-type-face
  247. (org-compatible-face nil
  248. '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
  249. (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
  250. (((class color) (min-colors 8)) (:foreground "green"))
  251. (t (:bold t))))
  252. "Face used for todo keywords that indicate DONE items."
  253. :group 'org-faces)
  254. (defface org-headline-done ;; originally copied from font-lock-string-face
  255. (org-compatible-face nil
  256. '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
  257. (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
  258. (((class color) (min-colors 8) (background light)) (:bold nil))))
  259. "Face used to indicate that a headline is DONE.
  260. This face is only used if `org-fontify-done-headline' is set. If applies
  261. to the part of the headline after the DONE keyword."
  262. :group 'org-faces)
  263. (defcustom org-todo-keyword-faces nil
  264. "Faces for specific TODO keywords.
  265. This is a list of cons cells, with TODO keywords in the car
  266. and faces in the cdr. The face can be a symbol, or a property
  267. list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
  268. :group 'org-faces
  269. :group 'org-todo
  270. :type '(repeat
  271. (cons
  272. (string :tag "keyword")
  273. (sexp :tag "face"))))
  274. (defface org-table ;; originally copied from font-lock-function-name-face
  275. (org-compatible-face nil
  276. '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
  277. (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
  278. (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
  279. (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
  280. (((class color) (min-colors 8) (background light)) (:foreground "blue"))
  281. (((class color) (min-colors 8) (background dark)))))
  282. "Face used for tables."
  283. :group 'org-faces)
  284. (defface org-formula
  285. (org-compatible-face nil
  286. '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
  287. (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
  288. (((class color) (min-colors 8) (background light)) (:foreground "red"))
  289. (((class color) (min-colors 8) (background dark)) (:foreground "red"))
  290. (t (:bold t :italic t))))
  291. "Face for formulas."
  292. :group 'org-faces)
  293. (defface org-code
  294. (org-compatible-face nil
  295. '((((class color grayscale) (min-colors 88) (background light))
  296. (:foreground "grey50"))
  297. (((class color grayscale) (min-colors 88) (background dark))
  298. (:foreground "grey70"))
  299. (((class color) (min-colors 8) (background light))
  300. (:foreground "green"))
  301. (((class color) (min-colors 8) (background dark))
  302. (:foreground "yellow"))))
  303. "Face for fixed-with text like code snippets."
  304. :group 'org-faces
  305. :version "22.1")
  306. (defface org-verbatim
  307. (org-compatible-face nil
  308. '((((class color grayscale) (min-colors 88) (background light))
  309. (:foreground "grey50" :underline t))
  310. (((class color grayscale) (min-colors 88) (background dark))
  311. (:foreground "grey70" :underline t))
  312. (((class color) (min-colors 8) (background light))
  313. (:foreground "green" :underline t))
  314. (((class color) (min-colors 8) (background dark))
  315. (:foreground "yellow" :underline t))))
  316. "Face for fixed-with text like code snippets."
  317. :group 'org-faces
  318. :version "22.1")
  319. (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
  320. (org-compatible-face nil
  321. '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
  322. (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
  323. (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
  324. (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
  325. (((class color) (min-colors 8)) (:foreground "blue" :bold t))
  326. (t (:bold t))))
  327. "Face used in agenda for captions and dates."
  328. :group 'org-faces)
  329. (unless (facep 'org-agenda-date)
  330. (copy-face 'org-agenda-structure 'org-agenda-date)
  331. (set-face-doc-string 'org-agenda-date
  332. "Face used in agenda for normal days."))
  333. (unless (facep 'org-agenda-date-weekend)
  334. (copy-face 'org-agenda-date 'org-agenda-date-weekend)
  335. (set-face-doc-string 'org-agenda-date-weekend
  336. "Face used in agenda for weekend days.
  337. See the variable `org-agenda-weekend-days' for a definition of which days
  338. belong to the weekend.")
  339. (when (fboundp 'set-face-attribute)
  340. (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
  341. (defface org-scheduled
  342. (org-compatible-face nil
  343. '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
  344. (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
  345. (((class color) (min-colors 8)) (:foreground "green"))
  346. (t (:bold t :italic t))))
  347. "Face for items scheduled for a certain day."
  348. :group 'org-faces)
  349. (defface org-scheduled-today
  350. (org-compatible-face nil
  351. '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
  352. (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
  353. (((class color) (min-colors 8)) (:foreground "green"))
  354. (t (:bold t :italic t))))
  355. "Face for items scheduled for a certain day."
  356. :group 'org-faces)
  357. (defface org-scheduled-previously
  358. (org-compatible-face nil
  359. '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
  360. (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
  361. (((class color) (min-colors 8) (background light)) (:foreground "red"))
  362. (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
  363. (t (:bold t))))
  364. "Face for items scheduled previously, and not yet done."
  365. :group 'org-faces)
  366. (defface org-upcoming-deadline
  367. (org-compatible-face nil
  368. '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
  369. (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
  370. (((class color) (min-colors 8) (background light)) (:foreground "red"))
  371. (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
  372. (t (:bold t))))
  373. "Face for items scheduled previously, and not yet done."
  374. :group 'org-faces)
  375. (defcustom org-agenda-deadline-faces
  376. '((1.0 . org-warning)
  377. (0.5 . org-upcoming-deadline)
  378. (0.0 . default))
  379. "Faces for showing deadlines in the agenda.
  380. This is a list of cons cells. The cdr of each cell is a face to be used,
  381. and it can also just be like '(:foreground \"yellow\").
  382. Each car is a fraction of the head-warning time that must have passed for
  383. this the face in the cdr to be used for display. The numbers must be
  384. given in descending order. The head-warning time is normally taken
  385. from `org-deadline-warning-days', but can also be specified in the deadline
  386. timestamp itself, like this:
  387. DEADLINE: <2007-08-13 Mon -8d>
  388. You may use d for days, w for weeks, m for months and y for years. Months
  389. and years will only be treated in an approximate fashion (30.4 days for a
  390. month and 365.24 days for a year)."
  391. :group 'org-faces
  392. :group 'org-agenda-daily/weekly
  393. :type '(repeat
  394. (cons
  395. (number :tag "Fraction of head-warning time passed")
  396. (sexp :tag "Face"))))
  397. (defface org-agenda-restriction-lock
  398. (org-compatible-face nil
  399. '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
  400. (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
  401. (((class color) (min-colors 16) (background light)) (:background "yellow1"))
  402. (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
  403. (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
  404. (t (:inverse-video t))))
  405. "Face for showing the agenda restriction lock."
  406. :group 'org-faces)
  407. (defface org-time-grid ;; originally copied from font-lock-variable-name-face
  408. (org-compatible-face nil
  409. '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
  410. (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
  411. (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
  412. "Face used for time grids."
  413. :group 'org-faces)
  414. (defconst org-level-faces
  415. '(org-level-1 org-level-2 org-level-3 org-level-4
  416. org-level-5 org-level-6 org-level-7 org-level-8
  417. ))
  418. (defcustom org-n-level-faces (length org-level-faces)
  419. "The number of different faces to be used for headlines.
  420. Org-mode defines 8 different headline faces, so this can be at most 8.
  421. If it is less than 8, the level-1 face gets re-used for level N+1 etc."
  422. :type 'number
  423. :group 'org-faces)
  424. (defface org-latex-and-export-specials
  425. (let ((font (cond ((assq :inherit custom-face-attributes)
  426. '(:inherit underline))
  427. (t '(:underline t)))))
  428. `((((class grayscale) (background light))
  429. (:foreground "DimGray" ,@font))
  430. (((class grayscale) (background dark))
  431. (:foreground "LightGray" ,@font))
  432. (((class color) (background light))
  433. (:foreground "SaddleBrown"))
  434. (((class color) (background dark))
  435. (:foreground "burlywood"))
  436. (t (,@font))))
  437. "Face used to highlight math latex and other special exporter stuff."
  438. :group 'org-faces)
  439. (provide 'org-faces)
  440. ;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04
  441. ;;; org-faces.el ends here