Release 6.05b.
[org-mode.git] / lisp / org-faces.el
blobb45ac67e5f6ffccaef9d37647edd928008d33857
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.05b
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 definitons 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-warning
207 (org-compatible-face 'font-lock-warning-face
208 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
209 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
210 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
211 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
212 (t (:bold t))))
213 "Face for deadlines and TODO keywords."
214 :group 'org-faces)
216 (defface org-archived ; similar to shadow
217 (org-compatible-face 'shadow
218 '((((class color grayscale) (min-colors 88) (background light))
219 (:foreground "grey50"))
220 (((class color grayscale) (min-colors 88) (background dark))
221 (:foreground "grey70"))
222 (((class color) (min-colors 8) (background light))
223 (:foreground "green"))
224 (((class color) (min-colors 8) (background dark))
225 (:foreground "yellow"))))
226 "Face for headline with the ARCHIVE tag."
227 :group 'org-faces)
229 (defface org-link
230 '((((class color) (background light)) (:foreground "Purple" :underline t))
231 (((class color) (background dark)) (:foreground "Cyan" :underline t))
232 (t (:underline t)))
233 "Face for links."
234 :group 'org-faces)
236 (defface org-ellipsis
237 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
238 (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
239 (t (:strike-through t)))
240 "Face for the ellipsis in folded text."
241 :group 'org-faces)
243 (defface org-target
244 '((((class color) (background light)) (:underline t))
245 (((class color) (background dark)) (:underline t))
246 (t (:underline t)))
247 "Face for links."
248 :group 'org-faces)
250 (defface org-date
251 '((((class color) (background light)) (:foreground "Purple" :underline t))
252 (((class color) (background dark)) (:foreground "Cyan" :underline t))
253 (t (:underline t)))
254 "Face for links."
255 :group 'org-faces)
257 (defface org-sexp-date
258 '((((class color) (background light)) (:foreground "Purple"))
259 (((class color) (background dark)) (:foreground "Cyan"))
260 (t (:underline t)))
261 "Face for links."
262 :group 'org-faces)
264 (defface org-tag
265 '((t (:bold t)))
266 "Face for tags."
267 :group 'org-faces)
269 (defface org-todo ; font-lock-warning-face
270 (org-compatible-face nil
271 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
272 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
273 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
274 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
275 (t (:inverse-video t :bold t))))
276 "Face for TODO keywords."
277 :group 'org-faces)
279 (defface org-done ;; originally copied from font-lock-type-face
280 (org-compatible-face nil
281 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
282 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
283 (((class color) (min-colors 8)) (:foreground "green"))
284 (t (:bold t))))
285 "Face used for todo keywords that indicate DONE items."
286 :group 'org-faces)
288 (defface org-headline-done ;; originally copied from font-lock-string-face
289 (org-compatible-face nil
290 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
291 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
292 (((class color) (min-colors 8) (background light)) (:bold nil))))
293 "Face used to indicate that a headline is DONE.
294 This face is only used if `org-fontify-done-headline' is set. If applies
295 to the part of the headline after the DONE keyword."
296 :group 'org-faces)
298 (defcustom org-todo-keyword-faces nil
299 "Faces for specific TODO keywords.
300 This is a list of cons cells, with TODO keywords in the car
301 and faces in the cdr. The face can be a symbol, or a property
302 list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
303 :group 'org-faces
304 :group 'org-todo
305 :type '(repeat
306 (cons
307 (string :tag "keyword")
308 (sexp :tag "face"))))
310 (defface org-table ;; originally copied from font-lock-function-name-face
311 (org-compatible-face nil
312 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
313 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
314 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
315 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
316 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
317 (((class color) (min-colors 8) (background dark)))))
318 "Face used for tables."
319 :group 'org-faces)
321 (defface org-formula
322 (org-compatible-face nil
323 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
324 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
325 (((class color) (min-colors 8) (background light)) (:foreground "red"))
326 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
327 (t (:bold t :italic t))))
328 "Face for formulas."
329 :group 'org-faces)
331 (defface org-code
332 (org-compatible-face nil
333 '((((class color grayscale) (min-colors 88) (background light))
334 (:foreground "grey50"))
335 (((class color grayscale) (min-colors 88) (background dark))
336 (:foreground "grey70"))
337 (((class color) (min-colors 8) (background light))
338 (:foreground "green"))
339 (((class color) (min-colors 8) (background dark))
340 (:foreground "yellow"))))
341 "Face for fixed-with text like code snippets."
342 :group 'org-faces
343 :version "22.1")
345 (defface org-verbatim
346 (org-compatible-face nil
347 '((((class color grayscale) (min-colors 88) (background light))
348 (:foreground "grey50" :underline t))
349 (((class color grayscale) (min-colors 88) (background dark))
350 (:foreground "grey70" :underline t))
351 (((class color) (min-colors 8) (background light))
352 (:foreground "green" :underline t))
353 (((class color) (min-colors 8) (background dark))
354 (:foreground "yellow" :underline t))))
355 "Face for fixed-with text like code snippets."
356 :group 'org-faces
357 :version "22.1")
359 (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
360 (org-compatible-face nil
361 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
362 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
363 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
364 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
365 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
366 (t (:bold t))))
367 "Face used in agenda for captions and dates."
368 :group 'org-faces)
370 (unless (facep 'org-agenda-date)
371 (copy-face 'org-agenda-structure 'org-agenda-date)
372 (set-face-doc-string 'org-agenda-date
373 "Face used in agenda for normal days."))
375 (unless (facep 'org-agenda-date-weekend)
376 (copy-face 'org-agenda-date 'org-agenda-date-weekend)
377 (set-face-doc-string 'org-agenda-date-weekend
378 "Face used in agenda for weekend days.
379 See the variable `org-agenda-weekend-days' for a definition of which days
380 belong to the weekend.")
381 (when (fboundp 'set-face-attribute)
382 (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
384 (defface org-scheduled-today
385 (org-compatible-face nil
386 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
387 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
388 (((class color) (min-colors 8)) (:foreground "green"))
389 (t (:bold t :italic t))))
390 "Face for items scheduled for a certain day."
391 :group 'org-faces)
393 (defface org-scheduled-previously
394 (org-compatible-face nil
395 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
396 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
397 (((class color) (min-colors 8) (background light)) (:foreground "red"))
398 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
399 (t (:bold t))))
400 "Face for items scheduled previously, and not yet done."
401 :group 'org-faces)
403 (defface org-upcoming-deadline
404 (org-compatible-face nil
405 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
406 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
407 (((class color) (min-colors 8) (background light)) (:foreground "red"))
408 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
409 (t (:bold t))))
410 "Face for items scheduled previously, and not yet done."
411 :group 'org-faces)
413 (defcustom org-agenda-deadline-faces
414 '((1.0 . org-warning)
415 (0.5 . org-upcoming-deadline)
416 (0.0 . default))
417 "Faces for showing deadlines in the agenda.
418 This is a list of cons cells. The cdr of each cell is a face to be used,
419 and it can also just be like '(:foreground \"yellow\").
420 Each car is a fraction of the head-warning time that must have passed for
421 this the face in the cdr to be used for display. The numbers must be
422 given in descending order. The head-warning time is normally taken
423 from `org-deadline-warning-days', but can also be specified in the deadline
424 timestamp itself, like this:
426 DEADLINE: <2007-08-13 Mon -8d>
428 You may use d for days, w for weeks, m for months and y for years. Months
429 and years will only be treated in an approximate fashion (30.4 days for a
430 month and 365.24 days for a year)."
431 :group 'org-faces
432 :group 'org-agenda-daily/weekly
433 :type '(repeat
434 (cons
435 (number :tag "Fraction of head-warning time passed")
436 (sexp :tag "Face"))))
438 (defface org-agenda-restriction-lock
439 (org-compatible-face nil
440 '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
441 (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
442 (((class color) (min-colors 16) (background light)) (:background "yellow1"))
443 (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
444 (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
445 (t (:inverse-video t))))
446 "Face for showing the agenda restriction lock."
447 :group 'org-faces)
449 (defface org-time-grid ;; originally copied from font-lock-variable-name-face
450 (org-compatible-face nil
451 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
452 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
453 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
454 "Face used for time grids."
455 :group 'org-faces)
457 (defconst org-level-faces
458 '(org-level-1 org-level-2 org-level-3 org-level-4
459 org-level-5 org-level-6 org-level-7 org-level-8
462 (defcustom org-n-level-faces (length org-level-faces)
463 "The number of different faces to be used for headlines.
464 Org-mode defines 8 different headline faces, so this can be at most 8.
465 If it is less than 8, the level-1 face gets re-used for level N+1 etc."
466 :type 'number
467 :group 'org-faces)
469 (defface org-latex-and-export-specials
470 (let ((font (cond ((assq :inherit custom-face-attributes)
471 '(:inherit underline))
472 (t '(:underline t)))))
473 `((((class grayscale) (background light))
474 (:foreground "DimGray" ,@font))
475 (((class grayscale) (background dark))
476 (:foreground "LightGray" ,@font))
477 (((class color) (background light))
478 (:foreground "SaddleBrown"))
479 (((class color) (background dark))
480 (:foreground "burlywood"))
481 (t (,@font))))
482 "Face used to highlight math latex and other special exporter stuff."
483 :group 'org-faces)
485 (provide 'org-faces)
487 ;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04
489 ;;; org-faces.el ends here