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