2008-12-17 Carsten Dominik <carsten.dominik@gmail.com>
[emacs.git] / lisp / org / org-faces.el
blob8200f27d80ef0fdb3ffca0da67dafc28b0657d6f
1 ;;; org-faces.el --- Face definitions for Org-mode.
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 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.15d
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-ellipsis
243 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
244 (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
245 (t (:strike-through t)))
246 "Face for the ellipsis in folded text."
247 :group 'org-faces)
249 (defface org-target
250 '((((class color) (background light)) (:underline t))
251 (((class color) (background dark)) (:underline t))
252 (t (:underline t)))
253 "Face for links."
254 :group 'org-faces)
256 (defface org-date
257 '((((class color) (background light)) (:foreground "Purple" :underline t))
258 (((class color) (background dark)) (:foreground "Cyan" :underline t))
259 (t (:underline t)))
260 "Face for links."
261 :group 'org-faces)
263 (defface org-sexp-date
264 '((((class color) (background light)) (:foreground "Purple"))
265 (((class color) (background dark)) (:foreground "Cyan"))
266 (t (:underline t)))
267 "Face for links."
268 :group 'org-faces)
270 (defface org-tag
271 '((t (:bold t)))
272 "Default face for tags.
273 Note that the variable `org-tag-faces' can be used to overrule this face for
274 specific tags."
275 :group 'org-faces)
277 (defface org-todo ; font-lock-warning-face
278 (org-compatible-face nil
279 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
280 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
281 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
282 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
283 (t (:inverse-video t :bold t))))
284 "Face for TODO keywords."
285 :group 'org-faces)
287 (defface org-done ;; originally copied from font-lock-type-face
288 (org-compatible-face nil
289 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
290 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
291 (((class color) (min-colors 8)) (:foreground "green"))
292 (t (:bold t))))
293 "Face used for todo keywords that indicate DONE items."
294 :group 'org-faces)
296 (defface org-headline-done ;; originally copied from font-lock-string-face
297 (org-compatible-face nil
298 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
299 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
300 (((class color) (min-colors 8) (background light)) (:bold nil))))
301 "Face used to indicate that a headline is DONE.
302 This face is only used if `org-fontify-done-headline' is set. If applies
303 to the part of the headline after the DONE keyword."
304 :group 'org-faces)
306 (defcustom org-todo-keyword-faces nil
307 "Faces for specific TODO keywords.
308 This is a list of cons cells, with TODO keywords in the car
309 and faces in the cdr. The face can be a symbol, or a property
310 list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
311 :group 'org-faces
312 :group 'org-todo
313 :type '(repeat
314 (cons
315 (string :tag "keyword")
316 (sexp :tag "face"))))
318 (defvar org-tags-special-faces-re nil)
319 (defun org-set-tag-faces (var value)
320 (set var value)
321 (if (not value)
322 (setq org-tags-special-faces-re nil)
323 (setq org-tags-special-faces-re
324 (concat ":\\(" (mapconcat 'car value "\\|") "\\):"))))
326 (defcustom org-tag-faces nil
327 "Faces for specific tags.
328 This is a list of cons cells, with tags in the car and faces in the cdr.
329 The face can be a symbol, or a property list of attributes,
330 like (:foreground \"blue\" :weight bold :underline t).
331 If you set this variable through customize, it will immediately be effective
332 in new buffers and in modified lines.
333 If you set it with Lisp, a restart of Emacs is required to activate the
334 changes."
335 :group 'org-faces
336 :group 'org-tags
337 :set 'org-set-tag-faces
338 :type '(repeat
339 (cons
340 (string :tag "Tag")
341 (sexp :tag "Face"))))
343 (defface org-table ;; originally copied from font-lock-function-name-face
344 (org-compatible-face nil
345 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
346 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
347 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
348 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
349 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
350 (((class color) (min-colors 8) (background dark)))))
351 "Face used for tables."
352 :group 'org-faces)
354 (defface org-formula
355 (org-compatible-face nil
356 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
357 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
358 (((class color) (min-colors 8) (background light)) (:foreground "red"))
359 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
360 (t (:bold t :italic t))))
361 "Face for formulas."
362 :group 'org-faces)
364 (defface org-code
365 (org-compatible-face nil
366 '((((class color grayscale) (min-colors 88) (background light))
367 (:foreground "grey50"))
368 (((class color grayscale) (min-colors 88) (background dark))
369 (:foreground "grey70"))
370 (((class color) (min-colors 8) (background light))
371 (:foreground "green"))
372 (((class color) (min-colors 8) (background dark))
373 (:foreground "yellow"))))
374 "Face for fixed-with text like code snippets."
375 :group 'org-faces
376 :version "22.1")
378 (defface org-verbatim
379 (org-compatible-face nil
380 '((((class color grayscale) (min-colors 88) (background light))
381 (:foreground "grey50" :underline t))
382 (((class color grayscale) (min-colors 88) (background dark))
383 (:foreground "grey70" :underline t))
384 (((class color) (min-colors 8) (background light))
385 (:foreground "green" :underline t))
386 (((class color) (min-colors 8) (background dark))
387 (:foreground "yellow" :underline t))))
388 "Face for fixed-with text like code snippets."
389 :group 'org-faces
390 :version "22.1")
392 (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
393 (org-compatible-face nil
394 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
395 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
396 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
397 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
398 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
399 (t (:bold t))))
400 "Face used in agenda for captions and dates."
401 :group 'org-faces)
403 (unless (facep 'org-agenda-date)
404 (copy-face 'org-agenda-structure 'org-agenda-date)
405 (set-face-doc-string 'org-agenda-date
406 "Face used in agenda for normal days."))
408 (unless (facep 'org-agenda-date-weekend)
409 (copy-face 'org-agenda-date 'org-agenda-date-weekend)
410 (set-face-doc-string 'org-agenda-date-weekend
411 "Face used in agenda for weekend days.
412 See the variable `org-agenda-weekend-days' for a definition of which days
413 belong to the weekend.")
414 (when (fboundp 'set-face-attribute)
415 (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
417 (defface org-scheduled
418 (org-compatible-face nil
419 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
420 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
421 (((class color) (min-colors 8)) (:foreground "green"))
422 (t (:bold t :italic t))))
423 "Face for items scheduled for a certain day."
424 :group 'org-faces)
426 (defface org-scheduled-today
427 (org-compatible-face nil
428 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
429 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
430 (((class color) (min-colors 8)) (:foreground "green"))
431 (t (:bold t :italic t))))
432 "Face for items scheduled for a certain day."
433 :group 'org-faces)
436 (defface org-scheduled-previously
437 (org-compatible-face nil
438 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
439 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
440 (((class color) (min-colors 8) (background light)) (:foreground "red"))
441 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
442 (t (:bold t))))
443 "Face for items scheduled previously, and not yet done."
444 :group 'org-faces)
446 (defface org-upcoming-deadline
447 (org-compatible-face nil
448 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
449 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
450 (((class color) (min-colors 8) (background light)) (:foreground "red"))
451 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
452 (t (:bold t))))
453 "Face for items scheduled previously, and not yet done."
454 :group 'org-faces)
456 (defcustom org-agenda-deadline-faces
457 '((1.0 . org-warning)
458 (0.5 . org-upcoming-deadline)
459 (0.0 . default))
460 "Faces for showing deadlines in the agenda.
461 This is a list of cons cells. The cdr of each cell is a face to be used,
462 and it can also just be like '(:foreground \"yellow\").
463 Each car is a fraction of the head-warning time that must have passed for
464 this the face in the cdr to be used for display. The numbers must be
465 given in descending order. The head-warning time is normally taken
466 from `org-deadline-warning-days', but can also be specified in the deadline
467 timestamp itself, like this:
469 DEADLINE: <2007-08-13 Mon -8d>
471 You may use d for days, w for weeks, m for months and y for years. Months
472 and years will only be treated in an approximate fashion (30.4 days for a
473 month and 365.24 days for a year)."
474 :group 'org-faces
475 :group 'org-agenda-daily/weekly
476 :type '(repeat
477 (cons
478 (number :tag "Fraction of head-warning time passed")
479 (sexp :tag "Face"))))
481 (defface org-agenda-restriction-lock
482 (org-compatible-face nil
483 '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
484 (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
485 (((class color) (min-colors 16) (background light)) (:background "yellow1"))
486 (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
487 (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
488 (t (:inverse-video t))))
489 "Face for showing the agenda restriction lock."
490 :group 'org-faces)
492 (defface org-time-grid ;; originally copied from font-lock-variable-name-face
493 (org-compatible-face nil
494 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
495 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
496 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
497 "Face used for time grids."
498 :group 'org-faces)
500 (defconst org-level-faces
501 '(org-level-1 org-level-2 org-level-3 org-level-4
502 org-level-5 org-level-6 org-level-7 org-level-8
505 (defcustom org-n-level-faces (length org-level-faces)
506 "The number of different faces to be used for headlines.
507 Org-mode defines 8 different headline faces, so this can be at most 8.
508 If it is less than 8, the level-1 face gets re-used for level N+1 etc."
509 :type 'number
510 :group 'org-faces)
512 (defface org-latex-and-export-specials
513 (let ((font (cond ((assq :inherit custom-face-attributes)
514 '(:inherit underline))
515 (t '(:underline t)))))
516 `((((class grayscale) (background light))
517 (:foreground "DimGray" ,@font))
518 (((class grayscale) (background dark))
519 (:foreground "LightGray" ,@font))
520 (((class color) (background light))
521 (:foreground "SaddleBrown"))
522 (((class color) (background dark))
523 (:foreground "burlywood"))
524 (t (,@font))))
525 "Face used to highlight math latex and other special exporter stuff."
526 :group 'org-faces)
528 (provide 'org-faces)
530 ;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04
532 ;;; org-faces.el ends here