Version number set to 6.01a, release 6.01a.
[org-mode.git] / lisp / org-faces.el
blob1b2d7d4b35de9a604cef7d3001510f266e5575d1
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.01a
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 (when (fboundp 'set-face-attribute)
163 ;; Make sure that a fixed-width face is used when we have a column table.
164 (set-face-attribute 'org-column nil
165 :height (face-attribute 'default :height)
166 :family (face-attribute 'default :family)))
168 (defface org-warning
169 (org-compatible-face 'font-lock-warning-face
170 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
171 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
172 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
173 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
174 (t (:bold t))))
175 "Face for deadlines and TODO keywords."
176 :group 'org-faces)
178 (defface org-archived ; similar to shadow
179 (org-compatible-face 'shadow
180 '((((class color grayscale) (min-colors 88) (background light))
181 (:foreground "grey50"))
182 (((class color grayscale) (min-colors 88) (background dark))
183 (:foreground "grey70"))
184 (((class color) (min-colors 8) (background light))
185 (:foreground "green"))
186 (((class color) (min-colors 8) (background dark))
187 (:foreground "yellow"))))
188 "Face for headline with the ARCHIVE tag."
189 :group 'org-faces)
191 (defface org-link
192 '((((class color) (background light)) (:foreground "Purple" :underline t))
193 (((class color) (background dark)) (:foreground "Cyan" :underline t))
194 (t (:underline t)))
195 "Face for links."
196 :group 'org-faces)
198 (defface org-ellipsis
199 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t))
200 (((class color) (background dark)) (:foreground "LightGoldenrod" :underline t))
201 (t (:strike-through t)))
202 "Face for the ellipsis in folded text."
203 :group 'org-faces)
205 (defface org-target
206 '((((class color) (background light)) (:underline t))
207 (((class color) (background dark)) (:underline t))
208 (t (:underline t)))
209 "Face for links."
210 :group 'org-faces)
212 (defface org-date
213 '((((class color) (background light)) (:foreground "Purple" :underline t))
214 (((class color) (background dark)) (:foreground "Cyan" :underline t))
215 (t (:underline t)))
216 "Face for links."
217 :group 'org-faces)
219 (defface org-sexp-date
220 '((((class color) (background light)) (:foreground "Purple"))
221 (((class color) (background dark)) (:foreground "Cyan"))
222 (t (:underline t)))
223 "Face for links."
224 :group 'org-faces)
226 (defface org-tag
227 '((t (:bold t)))
228 "Face for tags."
229 :group 'org-faces)
231 (defface org-todo ; font-lock-warning-face
232 (org-compatible-face nil
233 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
234 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
235 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
236 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
237 (t (:inverse-video t :bold t))))
238 "Face for TODO keywords."
239 :group 'org-faces)
241 (defface org-done ;; originally copied from font-lock-type-face
242 (org-compatible-face nil
243 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen" :bold t))
244 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen" :bold t))
245 (((class color) (min-colors 8)) (:foreground "green"))
246 (t (:bold t))))
247 "Face used for todo keywords that indicate DONE items."
248 :group 'org-faces)
250 (defface org-headline-done ;; originally copied from font-lock-string-face
251 (org-compatible-face nil
252 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
253 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
254 (((class color) (min-colors 8) (background light)) (:bold nil))))
255 "Face used to indicate that a headline is DONE.
256 This face is only used if `org-fontify-done-headline' is set. If applies
257 to the part of the headline after the DONE keyword."
258 :group 'org-faces)
260 (defcustom org-todo-keyword-faces nil
261 "Faces for specific TODO keywords.
262 This is a list of cons cells, with TODO keywords in the car
263 and faces in the cdr. The face can be a symbol, or a property
264 list of attributes, like (:foreground \"blue\" :weight bold :underline t)."
265 :group 'org-faces
266 :group 'org-todo
267 :type '(repeat
268 (cons
269 (string :tag "keyword")
270 (sexp :tag "face"))))
272 (defface org-table ;; originally copied from font-lock-function-name-face
273 (org-compatible-face nil
274 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
275 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
276 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
277 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
278 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
279 (((class color) (min-colors 8) (background dark)))))
280 "Face used for tables."
281 :group 'org-faces)
283 (defface org-formula
284 (org-compatible-face nil
285 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
286 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
287 (((class color) (min-colors 8) (background light)) (:foreground "red"))
288 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
289 (t (:bold t :italic t))))
290 "Face for formulas."
291 :group 'org-faces)
293 (defface org-code
294 (org-compatible-face nil
295 '((((class color grayscale) (min-colors 88) (background light))
296 (:foreground "grey50"))
297 (((class color grayscale) (min-colors 88) (background dark))
298 (:foreground "grey70"))
299 (((class color) (min-colors 8) (background light))
300 (:foreground "green"))
301 (((class color) (min-colors 8) (background dark))
302 (:foreground "yellow"))))
303 "Face for fixed-with text like code snippets."
304 :group 'org-faces
305 :version "22.1")
307 (defface org-verbatim
308 (org-compatible-face nil
309 '((((class color grayscale) (min-colors 88) (background light))
310 (:foreground "grey50" :underline t))
311 (((class color grayscale) (min-colors 88) (background dark))
312 (:foreground "grey70" :underline t))
313 (((class color) (min-colors 8) (background light))
314 (:foreground "green" :underline t))
315 (((class color) (min-colors 8) (background dark))
316 (:foreground "yellow" :underline t))))
317 "Face for fixed-with text like code snippets."
318 :group 'org-faces
319 :version "22.1")
321 (defface org-agenda-structure ;; originally copied from font-lock-function-name-face
322 (org-compatible-face nil
323 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
324 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
325 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
326 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
327 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
328 (t (:bold t))))
329 "Face used in agenda for captions and dates."
330 :group 'org-faces)
332 (unless (facep 'org-agenda-date)
333 (copy-face 'org-agenda-structure 'org-agenda-date)
334 (set-face-doc-string 'org-agenda-date
335 "Face used in agenda for normal days."))
337 (unless (facep 'org-agenda-date-weekend)
338 (copy-face 'org-agenda-date 'org-agenda-date-weekend)
339 (set-face-doc-string 'org-agenda-date-weekend
340 "Face used in agenda for weekend days.
341 See the variable `org-agenda-weekend-days' for a definition of which days
342 belong to the weekend.")
343 (when (fboundp 'set-face-attribute)
344 (set-face-attribute 'org-agenda-date-weekend nil :weight 'bold)))
346 (defface org-scheduled-today
347 (org-compatible-face nil
348 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
349 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
350 (((class color) (min-colors 8)) (:foreground "green"))
351 (t (:bold t :italic t))))
352 "Face for items scheduled for a certain day."
353 :group 'org-faces)
355 (defface org-scheduled-previously
356 (org-compatible-face nil
357 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
358 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
359 (((class color) (min-colors 8) (background light)) (:foreground "red"))
360 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
361 (t (:bold t))))
362 "Face for items scheduled previously, and not yet done."
363 :group 'org-faces)
365 (defface org-upcoming-deadline
366 (org-compatible-face nil
367 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
368 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
369 (((class color) (min-colors 8) (background light)) (:foreground "red"))
370 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
371 (t (:bold t))))
372 "Face for items scheduled previously, and not yet done."
373 :group 'org-faces)
375 (defcustom org-agenda-deadline-faces
376 '((1.0 . org-warning)
377 (0.5 . org-upcoming-deadline)
378 (0.0 . default))
379 "Faces for showing deadlines in the agenda.
380 This is a list of cons cells. The cdr of each cell is a face to be used,
381 and it can also just be like '(:foreground \"yellow\").
382 Each car is a fraction of the head-warning time that must have passed for
383 this the face in the cdr to be used for display. The numbers must be
384 given in descending order. The head-warning time is normally taken
385 from `org-deadline-warning-days', but can also be specified in the deadline
386 timestamp itself, like this:
388 DEADLINE: <2007-08-13 Mon -8d>
390 You may use d for days, w for weeks, m for months and y for years. Months
391 and years will only be treated in an approximate fashion (30.4 days for a
392 month and 365.24 days for a year)."
393 :group 'org-faces
394 :group 'org-agenda-daily/weekly
395 :type '(repeat
396 (cons
397 (number :tag "Fraction of head-warning time passed")
398 (sexp :tag "Face"))))
400 (defface org-agenda-restriction-lock
401 (org-compatible-face nil
402 '((((class color) (min-colors 88) (background light)) (:background "yellow1"))
403 (((class color) (min-colors 88) (background dark)) (:background "skyblue4"))
404 (((class color) (min-colors 16) (background light)) (:background "yellow1"))
405 (((class color) (min-colors 16) (background dark)) (:background "skyblue4"))
406 (((class color) (min-colors 8)) (:background "cyan" :foreground "black"))
407 (t (:inverse-video t))))
408 "Face for showing the agenda restriction lock."
409 :group 'org-faces)
411 (defface org-time-grid ;; originally copied from font-lock-variable-name-face
412 (org-compatible-face nil
413 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
414 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
415 (((class color) (min-colors 8)) (:foreground "yellow" :weight light))))
416 "Face used for time grids."
417 :group 'org-faces)
419 (defconst org-level-faces
420 '(org-level-1 org-level-2 org-level-3 org-level-4
421 org-level-5 org-level-6 org-level-7 org-level-8
424 (defcustom org-n-level-faces (length org-level-faces)
425 "The number of different faces to be used for headlines.
426 Org-mode defines 8 different headline faces, so this can be at most 8.
427 If it is less than 8, the level-1 face gets re-used for level N+1 etc."
428 :type 'number
429 :group 'org-faces)
431 (defface org-latex-and-export-specials
432 (let ((font (cond ((assq :inherit custom-face-attributes)
433 '(:inherit underline))
434 (t '(:underline t)))))
435 `((((class grayscale) (background light))
436 (:foreground "DimGray" ,@font))
437 (((class grayscale) (background dark))
438 (:foreground "LightGray" ,@font))
439 (((class color) (background light))
440 (:foreground "SaddleBrown"))
441 (((class color) (background dark))
442 (:foreground "burlywood"))
443 (t (,@font))))
444 "Face used to highlight math latex and other special exporter stuff."
445 :group 'org-faces)
447 (provide 'org-faces)
449 ;;; org-faces.el ends here