]> code.delx.au - gnu-emacs/blob - lisp/org/org-faces.el
6cf4db4df677cfd24c07cf06b1fe26816d261527
[gnu-emacs] / lisp / org / org-faces.el
1 ;;; org-faces.el --- Face definitions for Org-mode.
2
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
5 ;; Author: Carsten Dominik <carsten at orgmode dot org>
6 ;; Keywords: outlines, hypermedia, calendar, wp
7 ;; Homepage: http://orgmode.org
8 ;; Version: 6.13
9 ;;
10 ;; This file is part of GNU Emacs.
11 ;;
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.
16
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.
21
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25 ;;
26 ;;; Commentary:
27
28 ;; This file contains the face definitons for Org.
29
30 ;;; Code:
31
32 (require 'org-macs)
33 (require 'org-compat)
34
35 (defgroup org-faces nil
36 "Faces in Org-mode."
37 :tag "Org Faces"
38 :group 'org-font-lock)
39
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)
47
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)
58
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)
68
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)
80
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)
92
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)
100
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)
108
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)
116
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)
124
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)
132
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)
143
144 (defface org-property-value nil
145 "Face used for the value of a property."
146 :group 'org-faces)
147
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.
164
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.
170
171 2. The `org-column' face.
172
173 3. The remaining properties of the reference face.
174
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'.
182
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)
187
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)
199
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)))
205
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)
211
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)
221
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)
234
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)
241
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)
248
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)
255
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)
262
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)
269
270 (defface org-tag
271 '((t (:bold t)))
272 "Face for tags."
273 :group 'org-faces)
274
275 (defface org-todo ; font-lock-warning-face
276 (org-compatible-face nil
277 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
278 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
279 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
280 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
281 (t (:inverse-video t :bold t))))
282 "Face for TODO keywords."
283 :group 'org-faces)
284
285 (defface org-done ;; originally copied from font-lock-type-face
286 (org-compatible-face nil
287 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
288 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
289 (((class color) (min-colors 8)) (:foreground "green"))
290 (t (:bold t))))
291 "Face used for todo keywords that indicate DONE items."
292 :group 'org-faces)
293
294 (defface org-headline-done ;; originally copied from font-lock-string-face
295 (org-compatible-face nil
296 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
297 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
298 (((class color) (min-colors 8) (background light)) (:bold nil))))
299 "Face used to indicate that a headline is DONE.
300 This face is only used if `org-fontify-done-headline' is set. If applies
301 to the part of the headline after the DONE keyword."
302 :group 'org-faces)
303
304 (defcustom org-todo-keyword-faces nil
305 "Faces for specific TODO keywords.
306 This is a list of cons cells, with TODO keywords in the car
307 and faces in the cdr. The face can be a symbol, or a property
308 list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
309 :group 'org-faces
310 :group 'org-todo
311 :type '(repeat
312 (cons
313 (string :tag "keyword")
314 (sexp :tag "face"))))
315
316 (defface org-table ;; originally copied from font-lock-function-name-face
317 (org-compatible-face nil
318 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
319 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
320 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
321 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
322 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
323 (((class color) (min-colors 8) (background dark)))))
324 "Face used for tables."
325 :group 'org-faces)
326
327 (defface org-formula
328 (org-compatible-face nil
329 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
330 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
331 (((class color) (min-colors 8) (background light)) (:foreground "red"))
332 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
333 (t (:bold t :italic t))))
334 "Face for formulas."
335 :group 'org-faces)
336
337 (defface org-code
338 (org-compatible-face nil
339 '((((class color grayscale) (min-colors 88) (background light))
340 (:foreground "grey50"))
341 (((class color grayscale) (min-colors 88) (background dark))
342 (:foreground "grey70"))
343 (((class color) (min-colors 8) (background light))
344 (:foreground "green"))
345 (((class color) (min-colors 8) (background dark))
346 (:foreground "yellow"))))
347 "Face for fixed-with text like code snippets."
348 :group 'org-faces
349 :version "22.1")
350
351 (defface org-verbatim
352 (org-compatible-face nil
353 '((((class color grayscale) (min-colors 88) (background light))
354 (:foreground "grey50" :underline t))
355 (((class color grayscale) (min-colors 88) (background dark))
356 (:foreground "grey70" :underline t))
357 (((class color) (min-colors 8) (background light))
358 (:foreground "green" :underline t))
359 (((class color) (min-colors 8) (background dark))
360 (:foreground "yellow" :underline t))))
361 "Face for fixed-with text like code snippets."
362 :group 'org-faces
363 :version "22.1")
364
365 (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
366 (org-compatible-face nil
367 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
368 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
369 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
370 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
371 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
372 (t (:bold t))))
373 "Face used in agenda for captions and dates."
374 :group 'org-faces)
375
376 (unless (facep 'org-agenda-date)
377 (copy-face 'org-agenda-structure 'org-agenda-date)
378 (set-face-doc-string 'org-agenda-date
379 "Face used in agenda for normal days."))
380
381 (unless (facep 'org-agenda-date-weekend)
382 (copy-face 'org-agenda-date 'org-agenda-date-weekend)
383 (set-face-doc-string 'org-agenda-date-weekend
384 "Face used in agenda for weekend days.
385 See the variable `org-agenda-weekend-days' for a definition of which days
386 belong to the weekend.")
387 (when (fboundp 'set-face-attribute)
388 (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
389
390 (defface org-scheduled
391 (org-compatible-face nil
392 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
393 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
394 (((class color) (min-colors 8)) (:foreground "green"))
395 (t (:bold t :italic t))))
396 "Face for items scheduled for a certain day."
397 :group 'org-faces)
398
399 (defface org-scheduled-today
400 (org-compatible-face nil
401 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
402 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
403 (((class color) (min-colors 8)) (:foreground "green"))
404 (t (:bold t :italic t))))
405 "Face for items scheduled for a certain day."
406 :group 'org-faces)
407
408
409 (defface org-scheduled-previously
410 (org-compatible-face nil
411 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
412 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
413 (((class color) (min-colors 8) (background light)) (:foreground "red"))
414 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
415 (t (:bold t))))
416 "Face for items scheduled previously, and not yet done."
417 :group 'org-faces)
418
419 (defface org-upcoming-deadline
420 (org-compatible-face nil
421 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
422 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
423 (((class color) (min-colors 8) (background light)) (:foreground "red"))
424 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
425 (t (:bold t))))
426 "Face for items scheduled previously, and not yet done."
427 :group 'org-faces)
428
429 (defcustom org-agenda-deadline-faces
430 '((1.0 . org-warning)
431 (0.5 . org-upcoming-deadline)
432 (0.0 . default))
433 "Faces for showing deadlines in the agenda.
434 This is a list of cons cells. The cdr of each cell is a face to be used,
435 and it can also just be like '(:foreground \"yellow\").
436 Each car is a fraction of the head-warning time that must have passed for
437 this the face in the cdr to be used for display. The numbers must be
438 given in descending order. The head-warning time is normally taken
439 from `org-deadline-warning-days', but can also be specified in the deadline
440 timestamp itself, like this:
441
442 DEADLINE: <2007-08-13 Mon -8d>
443
444 You may use d for days, w for weeks, m for months and y for years. Months
445 and years will only be treated in an approximate fashion (30.4 days for a
446 month and 365.24 days for a year)."
447 :group 'org-faces
448 :group 'org-agenda-daily/weekly
449 :type '(repeat
450 (cons
451 (number :tag "Fraction of head-warning time passed")
452 (sexp :tag "Face"))))
453
454 (defface org-agenda-restriction-lock
455 (org-compatible-face nil
456 '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
457 (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
458 (((class color) (min-colors 16) (background light)) (:background "yellow1"))
459 (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
460 (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
461 (t (:inverse-video t))))
462 "Face for showing the agenda restriction lock."
463 :group 'org-faces)
464
465 (defface org-time-grid ;; originally copied from font-lock-variable-name-face
466 (org-compatible-face nil
467 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
468 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
469 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
470 "Face used for time grids."
471 :group 'org-faces)
472
473 (defconst org-level-faces
474 '(org-level-1 org-level-2 org-level-3 org-level-4
475 org-level-5 org-level-6 org-level-7 org-level-8
476 ))
477
478 (defcustom org-n-level-faces (length org-level-faces)
479 "The number of different faces to be used for headlines.
480 Org-mode defines 8 different headline faces, so this can be at most 8.
481 If it is less than 8, the level-1 face gets re-used for level N+1 etc."
482 :type 'number
483 :group 'org-faces)
484
485 (defface org-latex-and-export-specials
486 (let ((font (cond ((assq :inherit custom-face-attributes)
487 '(:inherit underline))
488 (t '(:underline t)))))
489 `((((class grayscale) (background light))
490 (:foreground "DimGray" ,@font))
491 (((class grayscale) (background dark))
492 (:foreground "LightGray" ,@font))
493 (((class color) (background light))
494 (:foreground "SaddleBrown"))
495 (((class color) (background dark))
496 (:foreground "burlywood"))
497 (t (,@font))))
498 "Face used to highlight math latex and other special exporter stuff."
499 :group 'org-faces)
500
501 (provide 'org-faces)
502
503 ;; arch-tag: 9dab5f91-c4b9-4d6f-bac3-1f6211ad0a04
504
505 ;;; org-faces.el ends here