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