org-faces.el 19 KB

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