Release 6.02b.
[org-mode.git] / lisp / org-faces.el
bloba9f8f3f21ba86860f3462ac41d32cc62c3fc3c58
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.02b
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, or (at your option)
15 ;; 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; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;;; Commentary:
30 ;; This file contains the face definitons for Org.
32 ;;; Code:
34 (require 'org-macs)
35 (require 'org-compat)
37 (defgroup org-faces nil
38 "Faces in Org-mode."
39 :tag "Org Faces"
40 :group 'org-font-lock)
42 (defface org-hide
43 '((((background light)) (:foreground "white"))
44 (((background dark)) (:foreground "black")))
45 "Face used to hide leading stars in headlines.
46 The forground color of this face should be equal to the background
47 color of the frame."
48 :group 'org-faces)
50 (defface org-level-1 ;; originally copied from font-lock-function-name-face
51 (org-compatible-face 'outline-1
52 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
53 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
54 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
55 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
56 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
57 (t (:bold t))))
58 "Face used for level 1 headlines."
59 :group 'org-faces)
61 (defface org-level-2 ;; originally copied from font-lock-variable-name-face
62 (org-compatible-face 'outline-2
63 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
64 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
65 (((class color) (min-colors 8) (background light)) (:foreground "yellow"))
66 (((class color) (min-colors 8) (background dark)) (:foreground "yellow" :bold t))
67 (t (:bold t))))
68 "Face used for level 2 headlines."
69 :group 'org-faces)
71 (defface org-level-3 ;; originally copied from font-lock-keyword-face
72 (org-compatible-face 'outline-3
73 '((((class color) (min-colors 88) (background light)) (:foreground "Purple"))
74 (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
75 (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
76 (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
77 (((class color) (min-colors 8) (background light)) (:foreground "purple" :bold t))
78 (((class color) (min-colors 8) (background dark)) (:foreground "cyan" :bold t))
79 (t (:bold t))))
80 "Face used for level 3 headlines."
81 :group 'org-faces)
83 (defface org-level-4 ;; originally copied from font-lock-comment-face
84 (org-compatible-face 'outline-4
85 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
86 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
87 (((class color) (min-colors 16) (background light)) (:foreground "red"))
88 (((class color) (min-colors 16) (background dark)) (:foreground "red1"))
89 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
90 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
91 (t (:bold t))))
92 "Face used for level 4 headlines."
93 :group 'org-faces)
95 (defface org-level-5 ;; originally copied from font-lock-type-face
96 (org-compatible-face 'outline-5
97 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
98 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
99 (((class color) (min-colors 8)) (:foreground "green"))))
100 "Face used for level 5 headlines."
101 :group 'org-faces)
103 (defface org-level-6 ;; originally copied from font-lock-constant-face
104 (org-compatible-face 'outline-6
105 '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
106 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
107 (((class color) (min-colors 8)) (:foreground "magenta"))))
108 "Face used for level 6 headlines."
109 :group 'org-faces)
111 (defface org-level-7 ;; originally copied from font-lock-builtin-face
112 (org-compatible-face 'outline-7
113 '((((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
114 (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
115 (((class color) (min-colors 8)) (:foreground "blue"))))
116 "Face used for level 7 headlines."
117 :group 'org-faces)
119 (defface org-level-8 ;; originally copied from font-lock-string-face
120 (org-compatible-face 'outline-8
121 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
122 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
123 (((class color) (min-colors 8)) (:foreground "green"))))
124 "Face used for level 8 headlines."
125 :group 'org-faces)
127 (defface org-special-keyword ;; originally copied from font-lock-string-face
128 (org-compatible-face nil
129 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
130 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
131 (t (:italic t))))
132 "Face used for special keywords."
133 :group 'org-faces)
135 (defface org-drawer ;; originally copied from font-lock-function-name-face
136 (org-compatible-face nil
137 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
138 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
139 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
140 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
141 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
142 (t (:bold t))))
143 "Face used for drawers."
144 :group 'org-faces)
146 (defface org-property-value nil
147 "Face used for the value of a property."
148 :group 'org-faces)
150 (defface org-column
151 (org-compatible-face nil
152 '((((class color) (min-colors 16) (background light))
153 (:background "grey90"))
154 (((class color) (min-colors 16) (background dark))
155 (:background "grey30"))
156 (((class color) (min-colors 8))
157 (:background "cyan" :foreground "black"))
158 (t (:inverse-video t))))
159 "Face for column display of entry properties."
160 :group 'org-faces)
162 (defface org-column-title
163 (org-compatible-face nil
164 '((((class color) (min-colors 16) (background light))
165 (:background "grey90" :underline t :weight bold))
166 (((class color) (min-colors 16) (background dark))
167 (:background "grey30" :underline t :weight bold))
168 (((class color) (min-colors 8))
169 (:background "cyan" :foreground "black" :underline t :weight bold))
170 (t (:inverse-video t))))
171 "Face for column display of entry properties."
172 :group 'org-faces)
174 (when (fboundp 'set-face-attribute)
175 ;; Make sure that a fixed-width face is used when we have a column table.
176 (set-face-attribute 'org-column nil
177 :height (face-attribute 'default :height)
178 :family (face-attribute 'default :family)))
180 (defface org-warning
181 (org-compatible-face 'font-lock-warning-face
182 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
183 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
184 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
185 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
186 (t (:bold t))))
187 "Face for deadlines and TODO keywords."
188 :group 'org-faces)
190 (defface org-archived ; similar to shadow
191 (org-compatible-face 'shadow
192 '((((class color grayscale) (min-colors 88) (background light))
193 (:foreground "grey50"))
194 (((class color grayscale) (min-colors 88) (background dark))
195 (:foreground "grey70"))
196 (((class color) (min-colors 8) (background light))
197 (:foreground "green"))
198 (((class color) (min-colors 8) (background dark))
199 (:foreground "yellow"))))
200 "Face for headline with the ARCHIVE tag."
201 :group 'org-faces)
203 (defface org-link
204 '((((class color) (background light)) (:foreground "Purple" :underline t))
205 (((class color) (background dark)) (:foreground "Cyan" :underline t))
206 (t (:underline t)))
207 "Face for links."
208 :group 'org-faces)
210 (defface org-ellipsis
211 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
212 (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
213 (t (:strike-through t)))
214 "Face for the ellipsis in folded text."
215 :group 'org-faces)
217 (defface org-target
218 '((((class color) (background light)) (:underline t))
219 (((class color) (background dark)) (:underline t))
220 (t (:underline t)))
221 "Face for links."
222 :group 'org-faces)
224 (defface org-date
225 '((((class color) (background light)) (:foreground "Purple" :underline t))
226 (((class color) (background dark)) (:foreground "Cyan" :underline t))
227 (t (:underline t)))
228 "Face for links."
229 :group 'org-faces)
231 (defface org-sexp-date
232 '((((class color) (background light)) (:foreground "Purple"))
233 (((class color) (background dark)) (:foreground "Cyan"))
234 (t (:underline t)))
235 "Face for links."
236 :group 'org-faces)
238 (defface org-tag
239 '((t (:bold t)))
240 "Face for tags."
241 :group 'org-faces)
243 (defface org-todo ; font-lock-warning-face
244 (org-compatible-face nil
245 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
246 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
247 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
248 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
249 (t (:inverse-video t :bold t))))
250 "Face for TODO keywords."
251 :group 'org-faces)
253 (defface org-done ;; originally copied from font-lock-type-face
254 (org-compatible-face nil
255 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
256 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
257 (((class color) (min-colors 8)) (:foreground "green"))
258 (t (:bold t))))
259 "Face used for todo keywords that indicate DONE items."
260 :group 'org-faces)
262 (defface org-headline-done ;; originally copied from font-lock-string-face
263 (org-compatible-face nil
264 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
265 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
266 (((class color) (min-colors 8) (background light)) (:bold nil))))
267 "Face used to indicate that a headline is DONE.
268 This face is only used if `org-fontify-done-headline' is set. If applies
269 to the part of the headline after the DONE keyword."
270 :group 'org-faces)
272 (defcustom org-todo-keyword-faces nil
273 "Faces for specific TODO keywords.
274 This is a list of cons cells, with TODO keywords in the car
275 and faces in the cdr. The face can be a symbol, or a property
276 list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
277 :group 'org-faces
278 :group 'org-todo
279 :type '(repeat
280 (cons
281 (string :tag "keyword")
282 (sexp :tag "face"))))
284 (defface org-table ;; originally copied from font-lock-function-name-face
285 (org-compatible-face nil
286 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
287 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
288 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
289 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
290 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
291 (((class color) (min-colors 8) (background dark)))))
292 "Face used for tables."
293 :group 'org-faces)
295 (defface org-formula
296 (org-compatible-face nil
297 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
298 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
299 (((class color) (min-colors 8) (background light)) (:foreground "red"))
300 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
301 (t (:bold t :italic t))))
302 "Face for formulas."
303 :group 'org-faces)
305 (defface org-code
306 (org-compatible-face nil
307 '((((class color grayscale) (min-colors 88) (background light))
308 (:foreground "grey50"))
309 (((class color grayscale) (min-colors 88) (background dark))
310 (:foreground "grey70"))
311 (((class color) (min-colors 8) (background light))
312 (:foreground "green"))
313 (((class color) (min-colors 8) (background dark))
314 (:foreground "yellow"))))
315 "Face for fixed-with text like code snippets."
316 :group 'org-faces
317 :version "22.1")
319 (defface org-verbatim
320 (org-compatible-face nil
321 '((((class color grayscale) (min-colors 88) (background light))
322 (:foreground "grey50" :underline t))
323 (((class color grayscale) (min-colors 88) (background dark))
324 (:foreground "grey70" :underline t))
325 (((class color) (min-colors 8) (background light))
326 (:foreground "green" :underline t))
327 (((class color) (min-colors 8) (background dark))
328 (:foreground "yellow" :underline t))))
329 "Face for fixed-with text like code snippets."
330 :group 'org-faces
331 :version "22.1")
333 (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
334 (org-compatible-face nil
335 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
336 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
337 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
338 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
339 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
340 (t (:bold t))))
341 "Face used in agenda for captions and dates."
342 :group 'org-faces)
344 (unless (facep 'org-agenda-date)
345 (copy-face 'org-agenda-structure 'org-agenda-date)
346 (set-face-doc-string 'org-agenda-date
347 "Face used in agenda for normal days."))
349 (unless (facep 'org-agenda-date-weekend)
350 (copy-face 'org-agenda-date 'org-agenda-date-weekend)
351 (set-face-doc-string 'org-agenda-date-weekend
352 "Face used in agenda for weekend days.
353 See the variable `org-agenda-weekend-days' for a definition of which days
354 belong to the weekend.")
355 (when (fboundp 'set-face-attribute)
356 (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
358 (defface org-scheduled-today
359 (org-compatible-face nil
360 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
361 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
362 (((class color) (min-colors 8)) (:foreground "green"))
363 (t (:bold t :italic t))))
364 "Face for items scheduled for a certain day."
365 :group 'org-faces)
367 (defface org-scheduled-previously
368 (org-compatible-face nil
369 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
370 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
371 (((class color) (min-colors 8) (background light)) (:foreground "red"))
372 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
373 (t (:bold t))))
374 "Face for items scheduled previously, and not yet done."
375 :group 'org-faces)
377 (defface org-upcoming-deadline
378 (org-compatible-face nil
379 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
380 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
381 (((class color) (min-colors 8) (background light)) (:foreground "red"))
382 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
383 (t (:bold t))))
384 "Face for items scheduled previously, and not yet done."
385 :group 'org-faces)
387 (defcustom org-agenda-deadline-faces
388 '((1.0 . org-warning)
389 (0.5 . org-upcoming-deadline)
390 (0.0 . default))
391 "Faces for showing deadlines in the agenda.
392 This is a list of cons cells. The cdr of each cell is a face to be used,
393 and it can also just be like '(:foreground \"yellow\").
394 Each car is a fraction of the head-warning time that must have passed for
395 this the face in the cdr to be used for display. The numbers must be
396 given in descending order. The head-warning time is normally taken
397 from `org-deadline-warning-days', but can also be specified in the deadline
398 timestamp itself, like this:
400 DEADLINE: <2007-08-13 Mon -8d>
402 You may use d for days, w for weeks, m for months and y for years. Months
403 and years will only be treated in an approximate fashion (30.4 days for a
404 month and 365.24 days for a year)."
405 :group 'org-faces
406 :group 'org-agenda-daily/weekly
407 :type '(repeat
408 (cons
409 (number :tag "Fraction of head-warning time passed")
410 (sexp :tag "Face"))))
412 (defface org-agenda-restriction-lock
413 (org-compatible-face nil
414 '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
415 (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
416 (((class color) (min-colors 16) (background light)) (:background "yellow1"))
417 (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
418 (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
419 (t (:inverse-video t))))
420 "Face for showing the agenda restriction lock."
421 :group 'org-faces)
423 (defface org-time-grid ;; originally copied from font-lock-variable-name-face
424 (org-compatible-face nil
425 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
426 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
427 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
428 "Face used for time grids."
429 :group 'org-faces)
431 (defconst org-level-faces
432 '(org-level-1 org-level-2 org-level-3 org-level-4
433 org-level-5 org-level-6 org-level-7 org-level-8
436 (defcustom org-n-level-faces (length org-level-faces)
437 "The number of different faces to be used for headlines.
438 Org-mode defines 8 different headline faces, so this can be at most 8.
439 If it is less than 8, the level-1 face gets re-used for level N+1 etc."
440 :type 'number
441 :group 'org-faces)
443 (defface org-latex-and-export-specials
444 (let ((font (cond ((assq :inherit custom-face-attributes)
445 '(:inherit underline))
446 (t '(:underline t)))))
447 `((((class grayscale) (background light))
448 (:foreground "DimGray" ,@font))
449 (((class grayscale) (background dark))
450 (:foreground "LightGray" ,@font))
451 (((class color) (background light))
452 (:foreground "SaddleBrown"))
453 (((class color) (background dark))
454 (:foreground "burlywood"))
455 (t (,@font))))
456 "Face used to highlight math latex and other special exporter stuff."
457 :group 'org-faces)
459 (provide 'org-faces)
461 ;;; org-faces.el ends here